[Solved] Maximize Form on Opening

Creating a macro - Writing a Script - Using the API

[Solved] Maximize Form on Opening

Postby BasilVSA » Thu Jun 27, 2019 12:25 pm

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
BasilVSA
 
Posts: 10
Joined: Tue Jun 18, 2019 4:34 pm

Re: Maximize Form on Opening

Postby Villeroy » Thu Jun 27, 2019 7:34 pm

Please do not post any screenshots unless you have a display issue.
Code: Select all   Expand viewCollapse view
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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 27718
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Maximize Form on Opening

Postby BasilVSA » Fri Jun 28, 2019 11:25 am

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
BasilVSA
 
Posts: 10
Joined: Tue Jun 18, 2019 4:34 pm

Re: Maximize Form on Opening

Postby Villeroy » Fri Jun 28, 2019 12:11 pm

Code: Select all   Expand viewCollapse view
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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 27718
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Maximize Form on Opening

Postby Villeroy » Fri Jun 28, 2019 12:21 pm

And for completeness, the same with a recorded full screen dispatch:
Code: Select all   Expand viewCollapse view
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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 27718
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Maximize Form on Opening (Solved)

Postby BasilVSA » Fri Jun 28, 2019 12:29 pm

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
BasilVSA
 
Posts: 10
Joined: Tue Jun 18, 2019 4:34 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 2 guests