Re: cancel dialog button doesn't quit Filemaker pro
Re: cancel dialog button doesn't quit Filemaker pro
- Subject: Re: cancel dialog button doesn't quit Filemaker pro
- From: Christopher Nebel <email@hidden>
- Date: Thu, 20 Dec 2001 12:52:09 -0800
On Tuesday, December 18, 2001, at 05:18 PM, Janis Rough wrote:
I thought if you hit the "cancel" button it cancels
the script or does it just cancel the dialog?
try
set v to cell "g_vendor_id" of current record
set the user_choice to the button returned of the result
{display dialog "Do you wish to create a Lettershop P.O. for
Vendor ID#"&
" "& v&"?" default button 1 buttons {"okay","cancel "} with
icon 2}
end try
Pressing the cancel button in "display dialog" causes the command to
throw a "user canceled" error. It's then up to you to either catch the
error using a try block and deal with it, or don't and let whatever
called your script deal with it. In this case, you've put the "display
dialog" call inside a try block with no error handler, which causes all
errors to be ignored, so your script continues merrily on. If you want
"cancel" to stop the script, removing the "try" and "end try" will
probably do the trick.
--Chris Nebel
AppleScript Engineering
P.S.: Is there any particular reason you put "display dialog" inside a
list? It shouldn't make any difference, and it's sort of weird.