Counting the number of selected checkboxes

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
Zak Juelz
Posts: 3
Joined: Tue Jul 05, 2016 9:42 am

Counting the number of selected checkboxes

Post by Zak Juelz » Tue Jul 05, 2016 10:29 am

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

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Counting the number of selected checkboxes

Post by Klaus » Tue Jul 05, 2016 2:54 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: Counting the number of selected checkboxes

Post by dunbarx » Tue Jul 05, 2016 3:26 pm

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

Zak Juelz
Posts: 3
Joined: Tue Jul 05, 2016 9:42 am

Re: Counting the number of selected checkboxes

Post by Zak Juelz » Wed Jul 06, 2016 6:44 am

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

Zak Juelz
Posts: 3
Joined: Tue Jul 05, 2016 9:42 am

Re: Counting the number of selected checkboxes

Post by Zak Juelz » Wed Jul 06, 2016 6:49 am

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: Counting the number of selected checkboxes

Post by dunbarx » Wed Jul 06, 2016 2:01 pm

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

Post Reply