Discussion:
Displaying Multiple Dialogs from BASIC
Hal Vaughan
2011-06-16 07:22:31 UTC
Permalink
I've mentioned the sticky-note project I'm working on yesterday in two emails.

Now I'm running into a problem: I'd like to display a number of sticky-notes, but to display any kind of dialog in BASIC, I need to do something like this:

oSticky = createUnoDialog(DialogLibraries.HalLib.StickyNote)
oSticky.Execute()

And the program will stop until I close the dialog, either by the close button, a cancel, or OK, or another button.

That means the only way to have multiple dialogs open is to open one and from there, open the next, and then open the next and so on.

Is there some way, from BASIC, to display a dialog and leave it open without it stopping a script?


Thank you!



Hal--
-----------------------------------------------------------------
To unsubscribe send email to dev-***@api.openoffice.org
For additional commands send email to ***@api.openoffice.org
with Subject: help
Fernand Vanrie
2011-06-16 07:30:18 UTC
Permalink
Hal ,

Y ou can set a Dialogcontrol visible or not , but we need a timeloop to
keep it visible

i use 2 sub's for open and closing

Sub Opendialog
bEnd = false
oDialogcontrol.setvisible(true)
Do
Wait 100 ' keep computer running (should use "wait for key event" if
existed)
Loop while not bEnd
end sub

sub CloseDialog(dialog as object)
dialog.setvisible(false)
Bend = true
end sub

Hop it Helps
Post by Hal Vaughan
I've mentioned the sticky-note project I'm working on yesterday in two emails.
oSticky = createUnoDialog(DialogLibraries.HalLib.StickyNote)
oSticky.Execute()
And the program will stop until I close the dialog, either by the close button, a cancel, or OK, or another button.
That means the only way to have multiple dialogs open is to open one and from there, open the next, and then open the next and so on.
Is there some way, from BASIC, to display a dialog and leave it open without it stopping a script?
Thank you!
Hal--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
To unsubscribe send email to dev-***@api.openoffice.org
For additional commands send email to ***@api.openoffice.org
with Subject: help
Hal Vaughan
2011-06-16 07:52:23 UTC
Permalink
Hal ,
Y ou can set a Dialogcontrol visible or not , but we need a timeloop to keep it visible
Am I right, then, in assuming that the time loop is there because once that particular instance of the script terminates, the dialog automatically closes?
i use 2 sub's for open and closing
Sub Opendialog
bEnd = false
oDialogcontrol.setvisible(true)
Do
Wait 100 ' keep computer running (should use "wait for key event" if existed)
Loop while not bEnd
end sub
sub CloseDialog(dialog as object)
dialog.setvisible(false)
Bend = true
end sub
Will this make the dialog invisible immediately, or as soon as the next loop in the other routine ends?

Thanks!

This is exactly what I need!


Hal
Hop it Helps
Post by Hal Vaughan
I've mentioned the sticky-note project I'm working on yesterday in two emails.
oSticky = createUnoDialog(DialogLibraries.HalLib.StickyNote)
oSticky.Execute()
And the program will stop until I close the dialog, either by the close button, a cancel, or OK, or another button.
That means the only way to have multiple dialogs open is to open one and from there, open the next, and then open the next and so on.
Is there some way, from BASIC, to display a dialog and leave it open without it stopping a script?
Thank you!
Hal--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
To unsubscribe send email to dev-***@api.openoffice.org
For additional commands send email to ***@api.openoffice.org
with Subject: help
Fernand Vanrie
2011-06-16 09:11:30 UTC
Permalink
Post by Hal Vaughan
Hal ,
Y ou can set a Dialogcontrol visible or not , but we need a timeloop to keep it visible
Am I right, then, in assuming that the time loop is there because once that particular instance of the script terminates, the dialog automatically closes?
i think the time loop keeps the dialog visible and alows to execute
other sub's

do a google on "Modal and non Modal dialog in Openoffice" to find more
advanced explainations
Post by Hal Vaughan
i use 2 sub's for open and closing
Sub Opendialog
bEnd = false
oDialogcontrol.setvisible(true)
Do
Wait 100 ' keep computer running (should use "wait for key event" if existed)
Loop while not bEnd
end sub
sub CloseDialog(dialog as object)
dialog.setvisible(false)
Bend = true
end sub
Will this make the dialog invisible immediately, or as soon as the next loop in the other routine ends?
Thanks!
This is exactly what I need!
Hal
Hop it Helps
Post by Hal Vaughan
I've mentioned the sticky-note project I'm working on yesterday in two emails.
oSticky = createUnoDialog(DialogLibraries.HalLib.StickyNote)
oSticky.Execute()
And the program will stop until I close the dialog, either by the close button, a cancel, or OK, or another button.
That means the only way to have multiple dialogs open is to open one and from there, open the next, and then open the next and so on.
Is there some way, from BASIC, to display a dialog and leave it open without it stopping a script?
Thank you!
Hal--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
To unsubscribe send email to dev-***@api.openoffice.org
For additional commands send email to ***@api.openoffice.org
with Subject: help
Hal Vaughan
2011-06-16 08:20:40 UTC
Permalink
This leads to a couple other questions:

1) On the CloseDialog() subroutine, if I want to execute it from a button in the dialog, how can I pass the dialog itself to the routine?

2) Is there any way to run a macro when the "X" on the title bar of the dialog is clicked?

Thanks!


Hal
Hal ,
Y ou can set a Dialogcontrol visible or not , but we need a timeloop to keep it visible
i use 2 sub's for open and closing
Sub Opendialog
bEnd = false
oDialogcontrol.setvisible(true)
Do
Wait 100 ' keep computer running (should use "wait for key event" if existed)
Loop while not bEnd
end sub
sub CloseDialog(dialog as object)
dialog.setvisible(false)
Bend = true
end sub
Hop it Helps
Post by Hal Vaughan
I've mentioned the sticky-note project I'm working on yesterday in two emails.
oSticky = createUnoDialog(DialogLibraries.HalLib.StickyNote)
oSticky.Execute()
And the program will stop until I close the dialog, either by the close button, a cancel, or OK, or another button.
That means the only way to have multiple dialogs open is to open one and from there, open the next, and then open the next and so on.
Is there some way, from BASIC, to display a dialog and leave it open without it stopping a script?
Thank you!
Hal--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
To unsubscribe send email to dev-***@api.openoffice.org
For additional commands send email to ***@api.openoffice.org
with Subject: help
Fernand Vanrie
2011-06-16 08:59:07 UTC
Permalink
Post by Hal Vaughan
1) On the CloseDialog() subroutine, if I want to execute it from a button in the dialog, how can I pass the dialog itself to the routine?
you can add a listener to the button (using code) or manualy using the
GUI to place a "event" on the button who call a macro subroutine
Post by Hal Vaughan
2) Is there any way to run a macro when the "X" on the title bar of the dialog is clicked?
no, you can add a listener on closing the dialog or using the the
"stetvisible" who avoid the functioning off the X and you can add a
"cancelbuton" who call a sub who close the dialog and do someting more...
Post by Hal Vaughan
Thanks!
Hal
Hal ,
Y ou can set a Dialogcontrol visible or not , but we need a timeloop to keep it visible
i use 2 sub's for open and closing
Sub Opendialog
bEnd = false
oDialogcontrol.setvisible(true)
Do
Wait 100 ' keep computer running (should use "wait for key event" if existed)
Loop while not bEnd
end sub
sub CloseDialog(dialog as object)
dialog.setvisible(false)
Bend = true
end sub
Hop it Helps
Post by Hal Vaughan
I've mentioned the sticky-note project I'm working on yesterday in two emails.
oSticky = createUnoDialog(DialogLibraries.HalLib.StickyNote)
oSticky.Execute()
And the program will stop until I close the dialog, either by the close button, a cancel, or OK, or another button.
That means the only way to have multiple dialogs open is to open one and from there, open the next, and then open the next and so on.
Is there some way, from BASIC, to display a dialog and leave it open without it stopping a script?
Thank you!
Hal--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
To unsubscribe send email to dev-***@api.openoffice.org
For additional commands send email to ***@api.openoffice.org
with Subject: help
Hal Vaughan
2011-06-16 09:22:11 UTC
Permalink
Post by Hal Vaughan
1) On the CloseDialog() subroutine, if I want to execute it from a button in the dialog, how can I pass the dialog itself to the routine?
you can add a listener to the button (using code) or manualy using the GUI to place a "event" on the button who call a macro subroutine
But when I do that, and the listener calls CloseDialog(), how do I make sure that particular Dialog object is available to the CloseDialog() subroutine? I tried it as you have it written and at the dialog.setvisible(false) line I got an error because the object was not defined.



Hal
Post by Hal Vaughan
2) Is there any way to run a macro when the "X" on the title bar of the dialog is clicked?
no, you can add a listener on closing the dialog or using the the "stetvisible" who avoid the functioning off the X and you can add a "cancelbuton" who call a sub who close the dialog and do someting more...
Post by Hal Vaughan
Thanks!
Hal
Hal ,
Y ou can set a Dialogcontrol visible or not , but we need a timeloop to keep it visible
i use 2 sub's for open and closing
Sub Opendialog
bEnd = false
oDialogcontrol.setvisible(true)
Do
Wait 100 ' keep computer running (should use "wait for key event" if existed)
Loop while not bEnd
end sub
sub CloseDialog(dialog as object)
dialog.setvisible(false)
Bend = true
end sub
Hop it Helps
Post by Hal Vaughan
I've mentioned the sticky-note project I'm working on yesterday in two emails.
oSticky = createUnoDialog(DialogLibraries.HalLib.StickyNote)
oSticky.Execute()
And the program will stop until I close the dialog, either by the close button, a cancel, or OK, or another button.
That means the only way to have multiple dialogs open is to open one and from there, open the next, and then open the next and so on.
Is there some way, from BASIC, to display a dialog and leave it open without it stopping a script?
Thank you!
Hal--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
To unsubscribe send email to dev-***@api.openoffice.org
For additional commands send email to ***@api.openoffice.org
with Subject: help
Fernand Vanrie
2011-06-16 09:28:33 UTC
Permalink
Hal ,

when using a Listner the Listener subroutine is called with a "EventObject"
the EventObject.source is the ButtonControl
the EventObject.source.context is the DialogControl



oDialogControl = oEvent.source.context
Post by Hal Vaughan
Post by Hal Vaughan
1) On the CloseDialog() subroutine, if I want to execute it from a button in the dialog, how can I pass the dialog itself to the routine?
you can add a listener to the button (using code) or manualy using the GUI to place a "event" on the button who call a macro subroutine
But when I do that, and the listener calls CloseDialog(), how do I make sure that particular Dialog object is available to the CloseDialog() subroutine? I tried it as you have it written and at the dialog.setvisible(false) line I got an error because the object was not defined.
Hal
Post by Hal Vaughan
2) Is there any way to run a macro when the "X" on the title bar of the dialog is clicked?
no, you can add a listener on closing the dialog or using the the "stetvisible" who avoid the functioning off the X and you can add a "cancelbuton" who call a sub who close the dialog and do someting more...
Post by Hal Vaughan
Thanks!
Hal
Hal ,
Y ou can set a Dialogcontrol visible or not , but we need a timeloop to keep it visible
i use 2 sub's for open and closing
Sub Opendialog
bEnd = false
oDialogcontrol.setvisible(true)
Do
Wait 100 ' keep computer running (should use "wait for key event" if existed)
Loop while not bEnd
end sub
sub CloseDialog(dialog as object)
dialog.setvisible(false)
Bend = true
end sub
Hop it Helps
Post by Hal Vaughan
I've mentioned the sticky-note project I'm working on yesterday in two emails.
oSticky = createUnoDialog(DialogLibraries.HalLib.StickyNote)
oSticky.Execute()
And the program will stop until I close the dialog, either by the close button, a cancel, or OK, or another button.
That means the only way to have multiple dialogs open is to open one and from there, open the next, and then open the next and so on.
Is there some way, from BASIC, to display a dialog and leave it open without it stopping a script?
Thank you!
Hal--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
To unsubscribe send email to dev-***@api.openoffice.org
For additional commands send email to ***@api.openoffice.org
with Subject: help
Hal Vaughan
2011-06-16 10:04:43 UTC
Permalink
Thanks! Okay, I'll check for typos and other possible mess-ups.

Hal
Post by Fernand Vanrie
Hal ,
when using a Listner the Listener subroutine is called with a "EventObject"
the EventObject.source is the ButtonControl
the EventObject.source.context is the DialogControl
oDialogControl = oEvent.source.context
Post by Hal Vaughan
Post by Hal Vaughan
1) On the CloseDialog() subroutine, if I want to execute it from a button in the dialog, how can I pass the dialog itself to the routine?
you can add a listener to the button (using code) or manualy using the GUI to place a "event" on the button who call a macro subroutine
But when I do that, and the listener calls CloseDialog(), how do I make sure that particular Dialog object is available to the CloseDialog() subroutine? I tried it as you have it written and at the dialog.setvisible(false) line I got an error because the object was not defined.
Hal
Post by Hal Vaughan
2) Is there any way to run a macro when the "X" on the title bar of the dialog is clicked?
no, you can add a listener on closing the dialog or using the the "stetvisible" who avoid the functioning off the X and you can add a "cancelbuton" who call a sub who close the dialog and do someting more...
Post by Hal Vaughan
Thanks!
Hal
Hal ,
Y ou can set a Dialogcontrol visible or not , but we need a timeloop to keep it visible
i use 2 sub's for open and closing
Sub Opendialog
bEnd = false
oDialogcontrol.setvisible(true)
Do
Wait 100 ' keep computer running (should use "wait for key event" if existed)
Loop while not bEnd
end sub
sub CloseDialog(dialog as object)
dialog.setvisible(false)
Bend = true
end sub
Hop it Helps
Post by Hal Vaughan
I've mentioned the sticky-note project I'm working on yesterday in two emails.
oSticky = createUnoDialog(DialogLibraries.HalLib.StickyNote)
oSticky.Execute()
And the program will stop until I close the dialog, either by the close button, a cancel, or OK, or another button.
That means the only way to have multiple dialogs open is to open one and from there, open the next, and then open the next and so on.
Is there some way, from BASIC, to display a dialog and leave it open without it stopping a script?
Thank you!
Hal--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
with Subject: help
--
-----------------------------------------------------------------
To unsubscribe send email to dev-***@api.openoffice.org
For additional commands send email to ***@api.openoffice.org
with Subject: help
Mathias Bauer
2011-06-16 09:17:06 UTC
Permalink
Post by Hal Vaughan
I've mentioned the sticky-note project I'm working on yesterday in two emails.
oSticky = createUnoDialog(DialogLibraries.HalLib.StickyNote)
oSticky.Execute()
And the program will stop until I close the dialog, either by the close button, a cancel, or OK, or another button.
That means the only way to have multiple dialogs open is to open one and from there, open the next, and then open the next and so on.
Is there some way, from BASIC, to display a dialog and leave it open without it stopping a script?
Execute() starts a modal mode, so it is not only understandable but also
required that further *linear* execution of the script stops (handlers
registered to buttons still we be called).

If you want to have more than one dialog, you have to execute them in a
modeless way. I don't know if

oSticky.SetVisible(True)

works (I even don't know if UnoDialogs export an XWindow interface), but
that's how it is done with C++ dialogs.

Besides that you will need to redesign your dialog a bit, modeless
dialogs usually don't have "OK" or "Cancel" buttons, because they
directly act on the document when their buttons are operated by the user.

If your dialog logic makes it necessary to have an "OK" button, most
probably a modal dialog is recommended and no other dialogs (except sub
dialogs) should be operable while it is visible.

Regards,
Mathias
--
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Oracle: http://blogs.sun.com/GullFOSS
Please don't reply to "***@gmx.de".
I use it for the OOo lists and only rarely read other mails sent to it.
--
-----------------------------------------------------------------
To unsubscribe send email to dev-***@api.openoffice.org
For additional commands send email to ***@api.openoffice.org
with Subject: help
Loading...