Page 1 of 1
Clearing all checkboxes in a stack
Posted: Fri May 29, 2009 6:30 am
by bidgeeman
Hello,
I have a group of checkboxes called "CheckboxGroup" on several different cards. The CheckboxGroup has the same name on each card.
I am using this code to clear the checkboxes on each card but I would like to clear ALL the checkbox groups in the stack:
Code: Select all
repeat with i = 1 to the number of buttons in group "CheckboxGroup"
unhilite button i of group "CheckboxGroup"
Can anyone offer some help?
Many thanks
Bidge
Posted: Fri May 29, 2009 8:17 am
by Mark
Hi Bidge,
If the sharedHilite of the checkboxes is false, then probably something like this:
Code: Select all
on TurnOffCheckboxes
repeat with x = 1 to number of cards
repeat with y = 1 to number of buttons of grp "CheckboxGroup" of cd x
set the hilite of btn y of grp "CheckboxGroup" of cd x to false
end repeat
end repeat
end TurnOffCheckboxes
Does this work for you?
Best,
Mark
Posted: Fri May 29, 2009 9:05 am
by bidgeeman
Hi Mark.
For some reason it's not working? I get an error on compile at this point:
on TurnOffCheckboxes
Cheers
Bidge
Posted: Fri May 29, 2009 9:12 am
by Mark
What exactly did you do, Bidge?
Mark
Posted: Fri May 29, 2009 9:22 am
by bidgeeman
Hi Mark.
I copied the cade and pasted it into my "clear" button but when I clicked compile this error came up at the start.
button "Clear Fields": compilation error at line 8 (Handler: error in command) near "on", char 1
Cheers
Bidge
Posted: Fri May 29, 2009 9:35 am
by Mark
Hi Bidge,
Are you sure that the script is completely empty except for the code I posted here? If not, what else is in the button script?
Best,
Mark
Posted: Fri May 29, 2009 9:43 am
by bidgeeman
Hi Mark.
This is what is in the button script:
on TurnOffCheckboxes
repeat with x = 1 to number of cards
repeat with y = 1 to number of buttons of grp "CheckboxGroup" of cd x
set the hilite of btn y of grp "CheckboxGroup" of cd x to false
end repeat
end repeat
end TurnOffCheckboxes
EDIT: Mark. I tried it again and the compile errr went away but nothing happened.
Cheers
Bidge
Posted: Fri May 29, 2009 9:47 am
by Mark
Bidge,
Have you tries restarting Revolution already? What else have you tried? I have tested the script and it doesn't cause an error here, when I compile it. There is probably a bug in Revolution or you have a script still running without knowing it (e.g. a repeat loop or a script with a recursive send command or because there is another script with an execution error, which hasn't been stopped yet).
Best,
Mark
Posted: Fri May 29, 2009 9:56 am
by bonbon
Hi Bidge,
Sticking my nose in ... what I think is happening is this: Mark's code is actually a procedure (I think Revolution calls this a custom command). So you could place Mark's code in the card (or stack) script, and then all you need to put in the button script is
If you only use the code in one place, and you want to put all of the code in the button script, all you need to do is remove the first and last lines, i.e. get rid of
and
Hope this helps.
Pete
Posted: Fri May 29, 2009 10:00 am
by bidgeeman
Hi Mark.
Here's a new test stack I made. Can you chaeck it to see what I've done wrong?
http://www.errolgray.com.au/CheckboxGroup.rev
EDIT: Oh...Sosorry....I'm an idiot. I replaced "on mouseUp" with "on TurnOffCheckboxes" it's working. Thanks Mark.
Thanks
Bidge
Posted: Fri May 29, 2009 10:20 am
by bidgeeman
Hi Mark.
There was another error being thrown up but I tracked it down to the fact that I did'nt have a CheckboxGroup" on every card in the stack. Once I placed a group on every stack the error dissapeared.
Thanks again for your help.
Cheers
Bidge