Page 1 of 1

Making of a non-modal dialog?

Posted: Fri May 16, 2008 9:08 am
by Spektr
Making of a non-modal dialog
Hello,
I want to write an macros for Calc that
shows an non-modal dialog. It should be non-modal because the user
must input a cell-range and doing it non-modal allows him to look at his
cells and scroll them while typing.
So how to do that?

Re: Making of a non-modal dialog?

Posted: Fri May 16, 2008 9:37 am
by Villeroy
Basic language?
Store your dialog in a global variable. Instead of executing the dialog, just make it visible.

Code: Select all

Global g_Dlg
Sub Main
oLib = DialogLibraries.MyLibrary
g_Dlg = CreateUnoDialog(oLib.getByName("Dialog1"))
g_Dlg.setVisible(True)
End Sub

Re: Making of a non-modal dialog?

Posted: Fri May 16, 2008 11:18 am
by Spektr
When I start a script, dialogue appears and disappears
What to do?

Re: Making of a non-modal dialog?

Posted: Fri May 16, 2008 11:56 am
by Villeroy
Search for both words "modal dialog" in the old API sub-forum http://www.oooforum.org/forum/search.phtml
There are plenty of examples. I think you need something like:

Code: Select all

Global g_Dlg, g_Stop as Boolean
Sub Main
...
REM test status every second:
do until gStop
   wait 1000
loop
g_Dlg.setVisible(False)
...

Sub someEvent()
   g_Stop = True
End Sub

Re: Making of a non-modal dialog?

Posted: Fri May 16, 2008 1:28 pm
by Spektr
Big thanks! :)