Page 1 of 1
Using group of checkboxes
Posted: Sat Feb 21, 2015 5:31 pm
by Ultravibe
Hello guys!
I need to use the group of checkboxes (7 checkboxes). And there must be not more than 4 boxes is checked (0-4). Where i can read some info about it?
Re: Using group of checkboxes
Posted: Sat Feb 21, 2015 5:48 pm
by Klaus
Hi Ultravibe,
I highly doubt that there is a tutorial or something for this very special problem.
But hey, it is pure logics, so its solvable with a bit of thinking!
Please check the attached stack and be sure to understand the logics!
Best
Klaus
Re: Using group of checkboxes
Posted: Sat Feb 21, 2015 6:28 pm
by Ultravibe
Thank you Klaus!
I've understand the logics of your script. And how can i operate with the values of these checkboxes?
for example: when i got separate checkboxes - everything is simple:
Code: Select all
if hilite of button "Check1" is true then --some actions...
or
Code: Select all
put hilite of button "Check1" into CheckDataVar
how can i use same syntax in button's group? i mean how to spell names of objects in group?
Re: Using group of checkboxes
Posted: Sat Feb 21, 2015 6:31 pm
by Ultravibe
Or i can use the names which i specify in property inspector independantly of grouping objects?
Re: Using group of checkboxes
Posted: Sat Feb 21, 2015 7:00 pm
by Klaus
Hi Ultravibe,
1. of course you should name YOUR buttons, I was just lazy and duplicated the same button a couple of times
2. Hm, why not put everything into the groups script?
When do you want to "trigger" your actions?
When the user CHECKS a button?
In any case I would create another handler in the group like this:
Code: Select all
command do_something tButtonName
switch tButtonName
case "Check1"
## do something...
break
case "Check2"
## do something else...
break
## etc...
end switch
end do_something
And call it by passing the short name of the target, maybe when checking a button:
Code: Select all
...
if target_can_be_checked() then
## We can check the target button
set the hilite of the target to TRUE
do_something the short name of the target
else
...
Best
Klaus
Re: Using group of checkboxes
Posted: Sat Feb 21, 2015 8:53 pm
by Ultravibe
Well, i'll tell you why i using restrictions of checking the boxes (no more than 4 is checked)?
I'm TV-director and soon will be a broadcast of tractor's races. I developing the software (and graphic design) for this event
Initially there are 24-30 riders. And with a few steps (i call it "stages"), some riders are gone.
At the stage #5, i've got 5-7 riders and i need to specify only 4 of them which is coming to semifinal.
Riders are earning points at the stage #5, but the final deŃision (who's coming to semifinal) is made by referees.
And my graphics operator just check the boxes of specified riders (we're listening the intercom of referees) and push some kind of "APPLY" button to send only 4 riders to semifinal)))))
So the checkbox group and "APPLY" button is differenet objects!
Re: Using group of checkboxes
Posted: Sun Feb 22, 2015 12:23 am
by Klaus
Hi Ultravibe,
aha, I see!
OK. do this:
1. Create a handler like this in the group script, I'm afraid we cannot avoid to check each buttons state:
Code: Select all
command do_something
switch
case the hilite of btn "Check1"
## do something...
break
case the hilite of btn "Check2"
## do something else...
break
## etc...
end switch
end do_something
2. Put this into the "Apply" button:
Code: Select all
on mouseup
send "do_something" to grp "the checkbox group"
end mouseup
There are many other ways to implement something like this, but this will work fine in this situation
Best
Klaus
Re: Using group of checkboxes
Posted: Sun Feb 22, 2015 12:30 pm
by Ultravibe
Thank you, one more time!
One more question:
I read a few fields from database - (put revDataFromQuery(tab,return,DatabaseID,QueryString) and put it to variable.
Fields of database is separated by tab characters in this variable. when i put it into fld "ShowTable" separated fields are automatically placed into different cells of fld.
And how can i separate them by program code and put it into different variables? Where can i find info about this?
Re: Using group of checkboxes
Posted: Sun Feb 22, 2015 1:02 pm
by Ultravibe
Or like this (on screenshot)
I use TextField. And put data which readed from database into TextField. I've enabled the highlighting of one row (without multi-row)
How can i get a number of selected row? What's the right syntax?
Re: Using group of checkboxes
Posted: Sun Feb 22, 2015 4:43 pm
by dunbarx
Hi.
It looks like this is a "table field", no? With "list behavior" set to true.
Look in the dictionary for "hilitedLine" and "selectedLine"
Craig Newman
Re: Using group of checkboxes
Posted: Sun Feb 22, 2015 6:22 pm
by Ultravibe
Craig Newman, thank you!