On 02/23/2013 03:24 AM, Hal Vaughan wrote:
Disclaimer: I have never tried or considered what you desire to do,
but..... I suppose that I would first test this (should be easy to do).
I have a macro in LO BASIC that sets up a dialog, then, instead of executing it, I do:
This dialog box contains a progress bar and, while testing it, I realized it's frustrating for
longer documents to have a progress bar and force me to sit and wait without a way to cancel it.
So I added a Cancel button.
This dialog is in my library and I'd like to find a way to set up the "Cancel" button so it can
either stop the script or possibly even call a clean up routine when it's been pressed - or have it change
the state of a global variable so a routine could see if it's been pressed.
I know there are event handlers so I can do something on events like MouseOver and so on.
And if I were not putting this in a library, I could easily specify, in the Dialog Settings, which
routine to call on Cancel.
But if I want the dialog in a library, is there a way, when calling the function that sets it up,
to specify a routine to call when the Cancel button is pressed? Or is there some way to create a
global variable or any kind of flag that I could have changed when the button is pressed?
In other words, other than putting in a "Stop" command, or specifying one routine name to call when
an event triggers it, can I pass on the name or pointer to a routine that would be called when the button is
First, what is it that you are doing that you desire to interrupt?
Specifically, is it your macro code that is running for a long time, or,
did it make a call that is running for a long time? If it is your own
macro, I would try setting a global in an event handler and check that
global in your code. You could create a quick test
while the "cancel requested global is not true" and two minutes has not
do something like add zero to a variable
Print "I am out and finished"
Then, you can check to see if you can set the global variable by
clicking on a cancel button and having the event handler be called. I am
not optimistic that this will work, but, it is worth a try. I am very
interested in your results.
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
For unsubscribe instructions e-mail to: firstname.lastname@example.org
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted
Impressum (Legal Info)
: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (MPLv2
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our trademark policy