"Ask" does not put empty into "it" when "Cancel" is clicked.

Jim Hurley jhurley at infostations.com
Thu Aug 18 13:05:41 EDT 2005


Is this a known change in 2.6?

The scrip below functioned as expected in Rev 2.5.  When the user 
click "Cancel" in response to the "ask" command the "it" variable was 
set to empty. Not so in 2.6.

In 2.6 the script behaves differently. When the user clicks "Cancel," 
there is a error response. The "ask" command does not return empty to 
the "it" variable--I'm not sure what "it" is. It shows empty but 
charToNum  return the zero character.

 From the Docs:

     If the user cancels the dialog, the it variable is set to empty 
and the result function returns "cancel".



on mouseUp
   ask "What field to save?"
   --User clicks "Cancel"
   if it is not empty then
     --Debugger steps into this line even
     --though "Cancel" was clicked.
     put it into temp1 --Shows empty
     put chartonum(it) into temp2 --Shows 0, i.e. zero
     put the result into temp3--Shows empty but should be "cancel"
     put field it into tContents --Error message
   else put field 1 into tContents
   ask file "Put where?"
   if it is not empty then
     put "file:"& it into tFileName
     put tContents into url  tFileName
   else
     beep
     exit mouseUP
   end if
end mouseUp

There is a work-around. Test the the "result" not "it," i.e. use:" If 
the result is not empty."

Jim


More information about the use-livecode mailing list