Writing a set of OOBasic-macros, embedded in a document template (.ott), I need a lot of different dialog boxes, all created in the OOBASIC IDE.
Problem allready solved
At any moment, I want to retrieve the active dialog box, using StarDeskTop.FindFrame. This function, however, expects each dialog box running in a named Frame:
Code: Select all
'Named frame allready exists?
oFrame=StarDesktop.findFrame("ActiveDialog", _
com.sun.star.frame.FrameSearchFlag.GLOBAL)
'No, so create it.
IF isNull(oFrame) THEN
oFrame=CreateUnoService("com.sun.star.frame.Frame")
oFrame.Initialize(StarDesktop.ActiveFrame.ContainerWindow)
oFrame.Name="ActiveDialog"
StarDesktop.Frames.append(oFrame)
END IF
'Link dialog to named frame.
oFrame.setComponent(oDialog,null)
Retrieving the dialog is now quite easy, anytime, anywhere:
Code: Select all
oFrame=StarDesktop.findFrame("ActiveDialog", _
com.sun.star.frame.FrameSearchFlag.GLOBAL)
oDialog=oFrame.ComponentWindow
Problem to solve
Running the dialog:
Code: Select all
oDialog.Execute
... covers (almost) the entire screen!
My approach, before calling .Execute:
Code: Select all
'The values are arbitrary - only for testing purposes.
WITH Dia.Model
.Width=400
.Height=300
.PositionX=20
.PositionY=20
END WITH
My request
I would be grateful if anybody knows how to reposition/resize the dialog window, or how to maintain the values set while creating the dialog in the OOBASIC IDE.