Global Madness

Chipp Walters chipp at chipp.com
Tue Mar 22 02:14:32 EST 2005


Howard,

I tried your script and got the exact same results. But, when I use:

put previewHeight/sHeight & "" into gHeightScaler

it works fine in the message box. Something about forcing the global to 
be a string is making it work. It turns out (from my testing on WinXP) 
the globalNames function doesn't display globals which are initialized 
as values, only those which are strings.

But, the global is still remembered by the stack just fine even if not 
converted to a string. So, it shouldn't be a problem in programming 
--unless you use the globalNames function. Then you can instantiate the 
global as a string (even empty) and use it as a value from then on.

For most people, this shouldn't be a problem.

Ken's fix:

global gHeightScaler;put gHeightScaler

works just fine too.

-Chipp

Howard Bornstein wrote:
> On Tue, 22 Mar 2005 14:15:56 +1200, Glen Boyd <glenb at napier.govt.nz> wrote:
> ?
> 
>>Have you declared this global in all stacks that require access to it?
>>If I recall correctly you need to specify the global in each stack that
>>you wish to use the variable globally in.
> 
> 
> 
> Yes. If you saw my test script I declared it at the beginning of the
> handler and only called it from that handler. I'd really appreciate it
> if someone could test this on another machine. It's a simple script,
> it's right there for you to copy and paste, and it just goes into a
> button.
> 
> Thanks.


More information about the use-livecode mailing list