Counting the number of checkboxes...

Dave Kilroy dave at
Sun Apr 20 14:05:39 EDT 2014

Hi Charles

If it was me I would be thinking of including something like a 'recordCheck'
handler in the stack's script that would be called by the mouseUp handler of
each checkbox button (or even better set the behaviour of each checkbox
button to the script of a button - but that is a bit more advanced and a
handler in the stack will work fine...)

In the 'recordCheck' handler I would record the name of the checkbox button
clicked and store it in some way, perhaps in a global variable or perhaps
writing it to a text file.

The button's stack might be something like:

on mouseUp
   put the short name of me into pName
   put the hilite of me into pState
   recordCheck pName, pState
end mouseUp

The handler in the stack might be something like:

on recordCheck pName pState
   put pName & tab & pState & cr after gListOfCheckedButtons
end recordCheck

So you can see that the name of the checkbox plus it's state has been sent
to the handler in the stack, that handler has appended the name and it's
state to a global variable 'gListOfCheckedButtons' - and then when you need
to find out what has been checked just look in the global variable.

PS: please note you should declare the global at the top of the script's
stack and you should also add some code to allow for when a user might
repeatedly check and uncheck a checkbox. Also I haven't included anything
about storing the data if you need to access it between launches of the
stack. But I've given  you enough to get you started?

Anyway, this is one way of doing what you want to, there are many others :)

Good luck


"Some are born coders, some achieve coding, and some have coding thrust upon them." - William Shakespeare & Hugh Senior

View this message in context:
Sent from the Revolution - User mailing list archive at

More information about the Use-livecode mailing list