Trapping for Cancel Answer printer
katir at hindu.org
katir at hindu.org
Sun Nov 30 14:46:55 EST 2003
Jeanne, this either needs fixed or needs documented.
Today on OSX Panther, Rev is not getting "Cancel" back to the local variable "it" from the print dialog box. "it" is empty. This is probably correct as the default engine behavior, but its not in the docs.
set the printmargins to 0,0,0,0
answer printer
if it is "Cancel" then
set the rect of this stack to gStackSize
exit printThisSloka
else
print card
end if
set the rect of this stack to gStackSize
restorePresentationPositions
In the print dialog box, the button is clearly "Cancel" but if I cancel, the script doesn't stop, the card is printed. On the other hand "the result" does work:
set the printmargins to 0,0,0,0
if the result is "Cancel" then
set the rect of this stack to gStackSize
exit printThisSloka
else
print card
end if
This is either a bug, where for use of "answer printer" Rev should pass the result to "it" or needs more documentation if the globally expected engine behavior is for anything from the system to *not* be in "it" but be passed via the result, which is also logical. Old time xTalkers may take that for granted, newbies will stumble
=====docs could say something like:
" data returned from system functions and system dialogs may not always be passed to the local variable "it". in such cases, the system response is probably in "the result." For example, if a user cancels a print job from the system Page Set up or Print Dialog, the local variable "it" will be empty, but, "the result" will be "Cancel," if the button pushed was "Cancel."
More information about the use-livecode
mailing list