Making of a non-modal dialog?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Spektr
Posts: 3
Joined: Fri May 16, 2008 8:58 am

Making of a non-modal dialog?

Post 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?
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Making of a non-modal dialog?

Post 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
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
Spektr
Posts: 3
Joined: Fri May 16, 2008 8:58 am

Re: Making of a non-modal dialog?

Post by Spektr »

When I start a script, dialogue appears and disappears
What to do?
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Making of a non-modal dialog?

Post 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
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
Spektr
Posts: 3
Joined: Fri May 16, 2008 8:58 am

Re: Making of a non-modal dialog?

Post by Spektr »

Big thanks! :)
Post Reply