First day at the 'office' for this LiveCode Newbie

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

Post Reply
Traxgeek
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Wed Jan 09, 2013 10:11 am

First day at the 'office' for this LiveCode Newbie

Post by Traxgeek » Wed Jan 09, 2013 10:33 am

Hi !
Wondered if someone could help ?

I'm new to LiveCode (come from years of VB, PCS, Corona and various others) and am following the various tutorials to 'port' an existing PCS app into LiveCode.

I fell at the first hurdle !! I'm trying to create a 'Global' variable. One which will be available to all handlers on all cards within a stack. Currently I have the line :

Code: Select all

global gbABC
and have placed it both within various handlers ('on startup', 'on stack open' etc) and as the first line of code (before and outwith any handlers) in my 'Stack' code page.

Each time I try to 'Apply' the use of the variable to any handler on a Card within the Stack I receive the error message :
button "chkMaintenance": compilation error at line 4 (Chunk: can't create a variable with that name (explicitVariables?)) near "gbABC", char 16
or very similar !

Can someone nudge me in the right direction please ?

Is there any basic help on how to declare variables and assign them 'types' (numeric, floating, string, boolean etc). I have read (and think I understand) the variable 'scope' logic within LiveCode - all makes sense but can't find how to declare a type and for the life of me (all day yesterday) can't work out why I can't access my global accross various Cards within my Stack.

Any and all kicks in generally the right direction would be welcome.

Thanks in advance.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1

Traxgeek
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Wed Jan 09, 2013 10:11 am

Re: First day at the 'office' for this LiveCode Newbie

Post by Traxgeek » Wed Jan 09, 2013 11:23 am

Ooops - Sorry to bother you all !

Found a great explanation in the Help file (which of course I only have working as a pdf at the moment !)

Sorry about that.

Bizarre having to re-declare a Global after having declared it (Stack level). Never heard of this - but it works for me !

Thanks anyway.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: First day at the 'office' for this LiveCode Newbie

Post by Dixie » Wed Jan 09, 2013 11:35 am

Instead of using a global variable.. look at using a custom property to hold your values.. page 222 in the user guide.. You then will not have to declare the global in the script of the stack or on each card where it will be used...

Dixie

Traxgeek
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Wed Jan 09, 2013 10:11 am

Re: First day at the 'office' for this LiveCode Newbie

Post by Traxgeek » Wed Jan 09, 2013 12:24 pm

Thanks a million Dixie.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1

Post Reply