If I close the form with this macro the events stop working

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
User avatar
NiksaVel
Posts: 91
Joined: Fri Jan 25, 2008 12:00 pm
Location: Croatia

If I close the form with this macro the events stop working

Post by NiksaVel »

Hi all,

first to explain what I'm trying to do... I have multiple forms and I navigate through them from form to form... what I want is that all the forms open up as fullscreen. I achieved this by mapping the following macro to the form "when loading" event:

Code: Select all

sub FullScreen
rem ----------------------------------------------------------------------
rem define variables
'dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "FullScreen"
args1(0).Value = true

dispatcher.executeDispatch(document, ".uno:FullScreen", "", 0, args1())

end sub

It works great!


However... if I close the form with the "close" macro that I use:

Code: Select all

REM  *****  BASIC  *****

Sub CloseForm

ThisComponent.CurrentController.Frame.close(FALSE)

End Sub

Sub Macro1

End Sub

than the second time I open the form it (from the database manager) will open windowed for some reason. If I close it with Alt+F4 than the fullscreen macro works the next time as advertised. A bit of a strange bug... can some1 clarify this behaviour for me a bit.

In practice working with forms directly and linking from form to form I don't have this problem... so it's no biggie... was just wondering...
OOo 3.1.X on Ubuntu 8.x + Linux Mint 7, Win XP, Vista
User avatar
DrewJensen
Volunteer
Posts: 1734
Joined: Sat Oct 06, 2007 9:01 pm
Location: Cumberland, MD - USA

Re: If I close the form with this macro the events stop working

Post by DrewJensen »

There is another way to close the form that i think will fix your problem.

It is an un-documented API call ( or rather an un-documented parameter to a documented call) in version 2.4 but is going to be published with 3.0, so should be safe to use..One of the developers talked about it on the Base mailing list a few weeks back...I'll go check the archives and see if I can find the entry and post it back here..OK
Former member of The Document Foundation
Former member of Apache OpenOffice PMC
LibreOffice on Ubuntu 18.04
Post Reply