Reacting to the user cancelling a print job

Ben Rubinstein benr_mc at cogapp.com
Fri Dec 2 07:28:58 CST 2011


On 02/12/2011 11:12, Mark Schonewille wrote:
> I have had this problem too and solved it. Please post your script.
>
> On 1 dec 2011, at 18:05, Ben Rubinstein wrote:
>
>> Is there any way to detect that the user is clicking the 'cancel' button on the 'printing' dialog that appears while printing from LiveCode?
>>
>> I can click the 'cancel' button, and the UI reacts (the message above the barber pole changes to "Canceling") but LiveCode doesn't, and I can't figure out where I'd see in code that the user is pressing it.  (On the other hand I also can't use command-period to halt the<cough>buggy</cough>  script, presumably because the 'printing in progress' dialog catches the keyboard event.)

Mark,

Thanks for responding.  I don't think I can post my script - it's currently a 
hideous mess of fragments and bits (because of course I never have bugs in my 
code once I move beyond that stage!).

But essentially it does 'open printing with dialog', then goes into a big loop 
in which it executes various 'print card from ... into rect' and 'print break' 
commands; finally it executes 'close printing'.

Immediately after the call to 'open printing with dialog', my code can check 
whether the the user clicked 'cancel' on that.  But from then until 'close 
printing', there's a printing progress dialog up, on which the user can click 
'cancel'; but I can't see a way to find out that they've clicked it; meanwhile 
because the dialog is there, they can't interact with my stack, so I can't 
give them any way to cancel the job.

Do you have a way to discover that the user has clicked cancel?

TIA,

Ben



More information about the use-livecode mailing list