Making of a non-modal dialog?

Creating a macro - Writing a Script - Using the API

Making of a non-modal dialog?

Postby Spektr » Fri May 16, 2008 9:08 am

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

Re: Making of a non-modal dialog?

Postby Villeroy » Fri May 16, 2008 9:37 am

Basic language?
Store your dialog in a global variable. Instead of executing the dialog, just make it visible.
Code: Select all   Expand viewCollapse view
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, OpenOffice 4.x & LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26623
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Making of a non-modal dialog?

Postby Spektr » Fri May 16, 2008 11:18 am

When I start a script, dialogue appears and disappears
What to do?
Spektr
 
Posts: 3
Joined: Fri May 16, 2008 8:58 am

Re: Making of a non-modal dialog?

Postby Villeroy » Fri May 16, 2008 11:56 am

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   Expand viewCollapse view
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, OpenOffice 4.x & LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26623
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Making of a non-modal dialog?

Postby Spektr » Fri May 16, 2008 1:28 pm

Big thanks! :)
Spektr
 
Posts: 3
Joined: Fri May 16, 2008 8:58 am


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 3 guests