Using Global Variables

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Using Global Variables

Post by jacque » Fri Jul 12, 2013 8:32 pm

If the problem comes back, let us know. It sounds like you did the right things but without seeing it, it's hard to tell. The errors you got are all symptoms of an undeclared global, so something wasn't right. But probably as you learn LiveCode it will all fall into place and by then you'll know what happened.

I'm really glad you are finding the experience rewarding. If you're like most of us, the affection just grows stronger over time.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Using Global Variables

Post by dunbarx » Fri Jul 12, 2013 10:26 pm

But that is exactly how it works. Globals must be declared either in the handler that needs them, or in the script that contains that handler. If a reference is made in a handler to a variable that has the same name as the global, but that global is not declared either in the handler itself or in the script that contains it, then LC will interpret that variable either as local or as a literal, depending on how it is referenced.

Reread the several posts in this thread. Practice with a few controls on a test card somewhere.

Keep at it.

Craig

Post Reply