variable list? Global var confusion

Dar Scott dsc at swcp.com
Tue Sep 2 01:11:01 EDT 2003


On Monday, September 1, 2003, at 11:42 PM, John Tenny wrote:

> What I have is from 2 to 10 buttons on a card, each adding/calculating 
> percent of totals for all the corresponding fields. Right now, I have 
> the scripts in each button, but they all access common variables. Is 
> there a way to put all that scripting into the card script? Or do you 
> mean that I can declare the variables as local in the card script, and 
> then have the handlers in each button as needed? There's no conflict 
> within the individual card, only between different cards.

One method is to leave each variable as local to the card script and 
use a function to get it and a handler to set it.

Another is to move most of your scripts to the card and have each 
button call a card script, perhaps with some parameters, perhaps just 
one with the field name.  The script can also use 'the target' to see 
which button was clicked, but that may not be needed here.

(Your aside:  Responding to mail in a digest is tedious and prone to 
errors.  I don't have good advice, except to note that I set up mail 
sorting on my mail client and address the lots-of-mail problem that 
way, that is, without a digest.  The problem is that I get chatty with 
that scheme.)

Dar Scott




More information about the use-livecode mailing list