Re: Question
Re: Question
- Subject: Re: Question
- From: Chris Nebel <email@hidden>
- Date: Mon, 04 Dec 2000 12:11:46 -0800
- Organization: Apple Computer, Inc.
Michelle Steiner wrote:
>
when you cancel the dialog, you're presented with the dialog again.
That's neither unexpected nor a side effect. Canceling a dialog has the same
effect as calling "error number -128." So your first "invalid" dialog
displays, you hit cancel, it throws error -128, which your "on error" block
catches and then displays the same dialog again. Being able to catch dialog
cancellations is a feature, not a bug. To get the dialog only once, you might
change the first call to "error" instead.
>
set invalid to "What the????"
>
>
display dialog "enter the radius" default answer ,
>
"" buttons {"Compute cirumference", " Compute area"}
>
set {myAnswer, myButton} to ,
>
{text returned, button returned} of the result
>
>
try
>
if myAnswer as number is greater than 0 then
>
if myButton is "compute cirumference" then
>
my displaydialog("cirumference", myAnswer * 2 * pi)
>
else
>
my displaydialog("area", myAnswer ^ 2 * pi)
>
end if
>
else
>
display dialog invalid
>
end if
>
on error
>
display dialog invalid
>
end try
>
>
on displaydialog(inputString, theNumber)
>
display dialog "The " & inputString & " is " & ,
>
theNumber buttons {"Yeah man"}
>
end displaydialog
--Chris Nebel
AppleScript Engineering
References: | |
| >Re: Question (From: Michelle Steiner <email@hidden>) |