Ask Your Question
0

Adjust size and placement of a form in Base

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

Tom Kuipers gravatar image

updated 2019-11-27 01:14:28 +0100

Ratslinger 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()
 oContainerWindow.setPosSize(295,0,850,1330,3)

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 close merge delete

Comments

Hello,

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 +0100 )edit

1 Answer

Sort by » oldest newest most voted
0

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

Ratslinger gravatar image

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

Hello,

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:

Sub SetYOURFORM
    Resize(850,1330,295,0)
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

Comments

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 +0100 )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 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

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

Seen: 29 times

Last updated: Nov 27