We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

Adjust size and placement of a form in Base [closed]

asked 2019-11-26 21:19:13 +0200

Tom Kuipers gravatar image

updated 2021-06-04 12:55:15 +0200

Alex Kemp gravatar image

After some searching, I found a routine that should check the size and placement of a (base) form. A note was posted elsewhere that this would not work properly in Release 6.3.

I use the following code (when opening the Document):

 oCurrentController = ThisComponent.getCurrentController()
 oFrame = oCurrentController.getFrame()
 oContainerWindow = oFrame.getContainerWindow()

This gives no error, but does not work (at all). However: The * X position * does * work *, but the rest does not, as far as I can tell. The size of a form can be adjusted online (in design and during execution) and will be used next time. Whether the same size is also used for other forms, I have not yet determined.

Is this indeed a bug, or am I (as a new OO user) doing something wrong?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2021-06-04 12:55:32.820050



This is an English site. For Dutch see -> https://ask.libreoffice.org/nl/questi...

Otherwise re-post in English by editing this question (not a new post).

Your problem can be solved.

Edit: Have translated for you. In future post in English on this site.

Ratslinger gravatar imageRatslinger ( 2019-11-26 22:26:03 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2019-11-27 01:27:17 +0200

Ratslinger gravatar image

updated 2019-11-27 07:03:22 +0200


There are multiple problems with form size and screen placement. For reference, and further explanation of the problems, see answer in this post -> Open a Base Form in a window

Have since modified the routine to make the positioning optional.

Here is the main routine:

Sub Resize(iWidth,iHeight,Optional iXPos,Optional iYPos) As Integer
REM      This cleans up the dead space
    Dim vRect as Object
    If IsNull(thisComponent.currentController.Frame) then exit sub
    vRect = thisComponent.currentController.Frame.ContainerWindow.PosSize
    Wait 200
    If IsMissing(iXPos) Then iXPos=vRect.X
    If IsMissing(iYPos) Then iYPos=vRect.Y
    thisComponent.currentController.Frame.ContainerWindow.setPosSize(iXPos, iYPos, iWidth, iHeight, 15)
    Wait 200
    thisComponent.currentController.Frame.ContainerWindow.setPosSize(iXPos, iYPos, iWidth, iHeight, 15)
End Sub

Now each form, with its own settings, can use a call to this routine with:

End Sub

I used your settings (you should double check these) in the example. This second sub is then attached to the Open Document event of the form.

edit flag offensive delete link more


Note: Wait 200 (occurs in two different lines) works on my system. You may need to increase by 100-200 if the routine doesn't seem to work.

Ratslinger gravatar imageRatslinger ( 2019-11-27 01:31:37 +0200 )edit

I have applied these setting in my application and am happy te see that this works exactly as intended.

Thanks very much for your help!

Tom Kuipers gravatar imageTom Kuipers ( 2019-11-27 19:53:16 +0200 )edit

Question Tools

1 follower


Asked: 2019-11-26 21:19:13 +0200

Seen: 328 times

Last updated: Nov 27 '19