empty ask result + ok = result:cancel

Eric Chatonet eric.chatonet at sosmartsoftware.com
Sun Jul 24 16:19:32 EDT 2005


Hi Xavier,

May be I'm wrong but your code makes no sense for me :-)
You want to get a result but you insert a line of code between the  
command and the request for the result: can't work.
You have to request the result immediately without requesting  
anything else to the engine in the meantime.
Then you ask replace with it:" it" is supposed to be a result and is  
not a result...
And I don't understand why you would place a result as default in an  
ask dialog...

As for me - but may be again, I'm wrong - I could write:

on mouseUp
   local f,x,y,txt
   -----
   put "viewbar" into f
   put fld f into txt
   -----
   ask "Replace what:" with lselection
   if the result = "cancel" then exit mouseUp
   put it into x
   -----
   ask "Replace with:" with it
   if the result = "cancel" then exit mouseUp
   put it into y
   -----
   replace x with y in fld f
end mouseUp

Le 24 juil. 05 à 20:04, MisterX a écrit :

> im implementing a nice search and replace function and well, check  
> it out...
>
> local lselection
>
> on mouseenter
>   put "viewbar" into f
>   get the selectedtext of fld f
>  put it into lselection
>   end if
> end mouseenter
>
> on mouseUp
>   local f,x,y,txt
>
>   put "viewbar" into f
>   put fld f into txt
>
>   ask "Replace what:" with lselection
>   put it into x
>   get the result
>   if it is "cancel" then exit mouseup
>   ask "Replace with:" with it
>   put it into y
>   get the result
>   if it is "cancel" then exit mouseup
>
>   replace x with y in fld f
> end mouseup
>
> Now, if i want to replace x with nothing, i leave the second ask
> empty but the result, despite clicking OK, is "Cancel"... grrr

Best Regards from Paris,

Eric Chatonet.
----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch

Free plugins and tutorials on my website
----------------------------------------------------------------
Web site        http://www.sosmartsoftware.com/
Email        eric.chatonet at sosmartsoftware.com/
Phone        33 (0)1 43 31 77 62
Mobile        33 (0)6 20 74 50 86
----------------------------------------------------------------




More information about the use-livecode mailing list