[Solved] Maximize Form on Opening

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
BasilVSA
Posts: 10
Joined: Tue Jun 18, 2019 4:34 pm

[Solved] Maximize Form on Opening

Post by BasilVSA »

Hi All, I have attached a PNG copy of a macro I use when accessing Base to automatically open a form. I would like to add code to this macro to either maximize the form or make it a full screen display (CTRL+SHIFT+J).

This I do not know how to do, so I would appreciate any assistance.
Attachments
Macro Main Form Open.jpg
Last edited by Hagar Delest on Fri Jun 28, 2019 9:28 pm, edited 1 time in total.
Reason: tagged solved
I am using LibreOffice 6.2.4.2 on both Windows 10 and Linux Mint 19.1 Cinnamon. I also want my colleague to be able use the Base database on his latest Macbook
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Maximize Form on Opening

Post by Villeroy »

Please do not post any screenshots unless you have a display issue.

Code: Select all

StarDesktop.CurrentFrame.ContainerWindow.IsMaximized = True
to be called after loading by some form event or document event (Tools>Customize)
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
BasilVSA
Posts: 10
Joined: Tue Jun 18, 2019 4:34 pm

Re: Maximize Form on Opening

Post by BasilVSA »

Hi Villeroy, thanks for the quick response. I'm not sure where to place the 'new' line of code in the current macro that I am using in order to maximize the form once opened at startup. It make sense to place it after the line of code that actually opens the form - this I tried and nothing happened.

Some simple code to open a form and then maximize it would be fine.
I am using LibreOffice 6.2.4.2 on both Windows 10 and Linux Mint 19.1 Cinnamon. I also want my colleague to be able use the Base database on his latest Macbook
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Maximize Form on Opening

Post by Villeroy »

Code: Select all

Sub MaximizeContainerWindow(e)
'globalscope.basiclibraries.loadlibrary("MRILib")
'mri e
win = e.Source.CurrentController.Frame.getContainerWIndow()
win.IsMaximized = True
End Sub
Open the form (it is just a Writer document), call menu:Tools>Customize and assign the "View created" event to that macro. You may want to store it globally under "My Macros" but it should work anywhere.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Maximize Form on Opening

Post by Villeroy »

And for completeness, the same with a recorded full screen dispatch:

Code: Select all

sub FullScreen(e)
frame = e.Source.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "FullScreen"
args1(0).Value = true
dispatcher.executeDispatch(frame, ".uno:FullScreen", "", 0, args1())
end sub
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
BasilVSA
Posts: 10
Joined: Tue Jun 18, 2019 4:34 pm

Re: Maximize Form on Opening (Solved)

Post by BasilVSA »

Thank you very much for the help. The maximize macro did not work but the fullscreen macro works perfectly and does what I require.
I am using LibreOffice 6.2.4.2 on both Windows 10 and Linux Mint 19.1 Cinnamon. I also want my colleague to be able use the Base database on his latest Macbook
Post Reply