Please suggest an easy way to deactivate a fields scripts

Jim Ault jimaultwins at yahoo.com
Wed Mar 18 14:41:24 CDT 2009


Why would you need to set the script of an object to something else  
while one of the handlers in that script container is running?   
Certainly you can reset scripts anywhere you like, but this is easily  
done from another script container.

If this is something you really need to do then build a handler in the  
stack script and call it from the mouseEnter.  This version is  
untested (but close) should work for any object you want.

------------  btn script
on mouseEnter
    send ("adjustMyScript" && the long name of me) to this stack in 10  
milliseconds
end mouseEnter

on mouseEnter2
   --do the work here
end mouseEnter2

------------- stack script
on adjustMyScript theCallingObject
    if the the cpKeepThis of the (theCallingObject) is empty then
       --we need to define some custom properties
       --these get saved with the stack
       get the script of theCallingObject
       set the cpKeepThis of the (theCallingObject) to line 1 to 14 of  
it
       set the cpCommentThis of the (theCallingObject) to line 15 to  
-2 of it
       set the cpEndHandler of the (theCallingObject) to line -1 of it
       save this stack
    end if
    get the cpKeepThis of the (theCallingObject)
    get it & cr
    get it & the cpEndHandler of the (theCallingObject)
    set the script of theCallingObject it
    save this stack
    send mouseEnter2 to theCallingObject in 10 millisecs
end adjustMyScript

This allows each object to store variations of the script in its own  
custom property structure.

If you put the button into a group, then you also have the group  
script available in the hierarchy before the card and stack script.

Jim Ault
Las Vegas

On Mar 18, 2009, at 8:04 AM, DunbarX at aol.com wrote:

>
> In a message dated 3/18/09 10:20:04 AM, shoreagent at gmail.com writes:
>
>
>> Craig
>>
>> Do you really do that in any of your scripts?
>>
>
> No. And you cannot. An error message states "you cannot set script  
> while it
> is executing". I tried:
>
> on mouseEnter
>    get the script of me
>    put line 1 to 14 of it & return into keepThis
>     put line 15 to the number of lines of it of it into commentThis
>    if the optionKey is down then
>       repeat with y = 1 to the number of lines of commentThis
>          put "--" before line y of commentThis
>       end repeat
>       else
>       replace "--" with empty in commentThis
>    end if
>    set the script of me to keepThis & commentThis
>    save stack "yourStack"
> end mouseEnter
>
>
>
>
> **************
> Great Deals on Dell 15" Laptops - Starting at $479
> (http://pr.atwola.com/promoclk/100126575x1220433363x1201394532/aol?redir=http:%2F%2Fad.doub
> leclick.net%2Fclk%3B212935224%3B34245239%3Bb)
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list