Correct syntax

Pierre Sahores psahores at easynet.fr
Fri Apr 29 15:58:15 EDT 2005


Hi Thomas,

Your statement is OK.

You just need to declare the global vars before using them in your 
handlers, so you can :

1.- declare them on top of your script, before any opened script, like :

global MyGlobal1, MyGlobal2,...

on mouseup
put "1" into MyGlobal1
... your code ...
end mouseup

2.- declare them inside the handler, like :

on mouseup
... your code ...
global MyGlobal1
put "1" into MyGlobal1
... your code ...
end mouseup

3.- It's, by convention, best readable to have the global vars declared 
just after the begining of the handler or on top of the script.

Hope this help,

Best Regards,

> Hello to this most helpful of lists,
>
> I would like to ask if putting globals needs to be right after a 
> handler name or is it OK to put it where I did below. My thinking is 
> they only need declared if I am going to do something with them. Is 
> this faster?
>
> The phover is a state where mouseDowns are not used so I don't want to 
> waste time here.
>
> on mouseDown
>   if the phover of this stack is "false" then
>     global gTheKeys, gTheMKeys, gInputTrayText
>     put the short name of the target into ltheCheck
>     if (lTheCheck is among the lines of gTheKeys) or (lTheCheck is 
> among the lines of gTheBKeys) then
>       put field "Inputtray" into gInputTrayText
>       CheckPreviewButtons  --
>     else
>       pass mouseDown
>     end if
>   end if
> end mouseDown
>
> ALSO, Is the 'pass mouseDown' necessary here?  My thinking is that if 
> we are in a state for using mouseDown but not in my 'special' keys 
> then pass the message on to stack to deal with if needed. BUT I don't 
> imagine needing it then SO is it really necessary?
>
> Thank you,
>
> Tom
>
> Thomas J. McGrath III
> SCS
> 1000 Killarney Dr.
> Pittsburgh, PA 15234
> 412-885-8541
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
-- 
Bien cordialement, Pierre Sahores

100, rue de Paris
F - 77140 Nemours

psahores+ at +easynet.fr
sc+ at +sahores-conseil.com

GSM:   +33 6 03 95 77 70
Pro:      +33 1 64 45 05 33
Fax:      +33 1 64 45 05 33

<http://www.sahores-conseil.com/>

WEB/VoD/ACID-DB services over IP
"Mutualiser les deltas de productivité"




More information about the use-livecode mailing list