Page 1 of 1

Counting the number of selected checkboxes

Posted: Tue Jul 05, 2016 10:29 am
by Zak Juelz
Hey, I have been trying to figure out how to count the number of selected check boxes or yes values returned by selecting yes or no from a menu, I need assistance please. Anyone with some way around the issue?

Regards

Re: Counting the number of selected checkboxes

Posted: Tue Jul 05, 2016 2:54 pm
by Klaus
Hi Zak,

1. welcome to the forum! :D

2. Please only one thread per problem, will delete all duplicates.

This is a forum and if someone knows the answer to your questuon(s) she/he will answer.
You cannot speed this up by opening more than one thread for your same problem or hijack a 2 year old thread for this!
That is bad style! 8)

3. Now what exactly is your problem?
Checkboxes or a menu?
Did you somehow "organize" the checkboxes like putting them all in the same group?

Here some great learning resources for the basics of Livecode, some answers may also be found in the "Controls" stack :D
http://www.hyperactivesw.com/revscriptc ... ences.html


Best

Klaus

Re: Counting the number of selected checkboxes

Posted: Tue Jul 05, 2016 3:26 pm
by dunbarx
What Klaus said.

If you check a checkbox, its "hilite" property is set to "true". So you loop through the number of buttons, and if the style is "checkBox" and the hilite is "true", well then...

As for a menu style button, the "label" property is set to the text of the selected menuItem. Same procedure.

Craig Newman

Re: Counting the number of selected checkboxes

Posted: Wed Jul 06, 2016 6:44 am
by Zak Juelz
Hi Klaus,

Thanks for warm welcome to the forum, really looking foward to learning how to use LiveCode to develop powerful apps :)
My apologies for posting twice, I only noted I had posted in the experts forum so I reposted here. It won't happen again.
Thank you for feedback, I will try out working on suggestions and see how it works out.

Best regards

Re: Counting the number of selected checkboxes

Posted: Wed Jul 06, 2016 6:49 am
by Zak Juelz
Hi Craig,

Thank you for suggestion, I will implement it your way and see how it works out for me. I was stuck at that point for days, nothing seemed to be working.
I will get back to you as soon as I've tried it out.

Best regards

Re: Counting the number of selected checkboxes

Posted: Wed Jul 06, 2016 2:01 pm
by dunbarx
Spoken like a gentleman.

You are familiar with how to do what I said, right? (Pseudo):

Code: Select all

repeat with y = 1 to the number of buttons
if the style of btn y = "checkbox" and the hilite of btn y = "true" then
  add 1 to yourButtonCounter
  updateYourButonList
Craig