LibreOffice Base form size not saving

I saw several posts on here regarding issues with LibreOffice Base forms not saving the correct size. I upgraded from version 6.1 to 7.0.4 and the issue still persists. It seems the issue has persisted for years, from what I have seen in the forum. And I was not able to get the simple macro to work.

I created the macro under
Tools → Macros → Organize Macros → Basic:

Sub fm_FormName
thisComponent.currentController.Frame.ContainerWindow.PosSize(100, 100, 100, 100, 15)
End Sub

And then in design mode for the form, I assigned the macro:
Tools → Customize → Events

I tried each the ‘Document loading finished’, ‘Open Document’, and ‘Activate Document’. None worked and the form continues to open on the entire screen. Please let me know if this has finally been fixed in version 7 (and I’m missing a setting or something). Or if there is a different macro that should be used. Thank you!

Hello,

There are a few problems with your statement.

PosSize should be setPosSize. Your window size (100x100) is very small and needs to be larger. There is a further bug which hampers the location being set correctly. You need to duplicate the statement and wait between statements. This code will work (attached to Open Document event of the form):

Sub fm_FormName
    thisComponent.currentController.Frame.ContainerWindow.setPosSize(100, 100, 100, 100, 15)
    Wait 200
    thisComponent.currentController.Frame.ContainerWindow.setPosSize(100, 100, 100, 100, 15)
End Sub

For use in multiple forms, see my answer in this post → Adjust size and placement of a form in Base

BTW this is still an open issue. tdf#115619

Awesome. Thank you for clarifying about the second / duplicate statement. With correcting that, and fixing the function call, it’s working great - especially at the larger size you suggested. Cheers.

@mattl,

Glad all is working for you.

As you have been helped, please help others to know the question has been answered by clicking on the :heavy_check_mark: in upper left area of answer which satisfied the question.