This works and doesn't work.

Apparently, what happens is that as long as the macro is busy (or maybe it's 
just with functions that take a long time in comparison, like exporting a PDF), 
the Cancel button I made on the dialog does not get attention.  So if I click 
on it once, usually nothing happens.  But if I keep clicking on it, over and 
over, and I hit it when the interpreter has time to check the status of the 
button, then it works.

I'm trying to think of a way to get LO to check the button to see if there HAS 
BEEN an event, as opposed to checking to see if there IS an event, but I'm 
stumped.

So, other than the delay issue, this could work.



Hal

On Feb 24, 2013, at 9:32 AM, Andrew Douglas Pitonyak <[email protected]> 
wrote:

> 
> On 02/23/2013 03:24 AM, Hal Vaughan wrote:
>> I have a macro in LO BASIC that sets up a dialog, then, instead of executing 
>> it, I do:
>> 
>> oDialog.setVisible(TRUE)
>> 
>> 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 pressed?
>> 
>> 
>> Hal
> 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).
> 
> 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 
> elapsed
> 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.
> 
> 
> -- 
> Andrew Pitonyak
> My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
> Info:  http://www.pitonyak.org/oo.php
> 
> 
> -- 
> For unsubscribe instructions e-mail to: [email protected]
> Problems? 
> http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
> 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
> 
> 


-- 
For unsubscribe instructions e-mail to: [email protected]
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
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

Reply via email to