Page 1 of 1

How to auto-select radio buttons

Posted: Thu Apr 09, 2015 5:48 pm
by ali
First time poster:
I have 3 radio buttons. I want radio buttons 2 and 3, to get auto-selected if radio button 1 is manually selected. I have searched for "radio buttons" and could not find relevant content.

Any help is appreciated.

Re: How to auto-select radio buttons

Posted: Thu Apr 09, 2015 6:48 pm
by sritcp
ali wrote:I have searched for "radio buttons" and could not find relevant content.
1. User Manual (accessible from within LiveCode program) gives an overview of radio buttons.
2. Don't miss the scripting conference materials, downloadable at
http://www.hyperactivesw.com/revscriptc ... ences.html
The third chapter on "Controls" by Klaus is what you need. A must read!

"Radio" buttons have a specific meaning (and characteristic). When you select one, the others are "auto DE-selected", not auto-selected. Is this what you need?
Again, do the scripting conference tutorial mentioned above.
These are in the form of stacks. You open them in LiveCode and follow along.

Regards,
Sri.

Re: How to auto-select radio buttons

Posted: Thu Apr 09, 2015 8:17 pm
by dunbarx
What Sri said.

But you can have it any way you want, since you are in charge, though I might suggest using checkBoxes instead of radio buttons.

Anyway, if you are a first time poster, does that mean you have some experience with writing handlers? Let me know, and I will give you a few small learning tasks that will get your buttons in a row.

Craig Newman

Re: How to auto-select radio buttons

Posted: Fri Apr 10, 2015 5:11 pm
by ali
Below is snippet that does what I needed:
/*
on mouseUp
if the hilite of me then
set the hilite of btn "c2" to true
set the hilite of btn "c3" to true
else
set the hilite of btn "c2" to false
set the hilite of btn "c3" to false
end if
end mouseUp
*/
Note: c1, c2 and c3 are check-button names. c1 manipulates c2 and c3 but not vice versa.

Thanks for your helpful inputs.

Re: How to auto-select radio buttons

Posted: Fri Apr 10, 2015 5:28 pm
by dunbarx
HI..

Just so.

A little more elegant, and this is only a matter of style:

Code: Select all

on mouseUp
  set the hilite of btn "c2" to the hilite of me
  set the hilite of btn "c3" to the hilite of me
end mouseUp
But if you look at this, you might get a little "Eureka" on the subject of how cool LC is.

Craig

Re: How to auto-select radio buttons

Posted: Fri Apr 10, 2015 5:38 pm
by FourthWorld
Put the buttons in a group and the user interaction is handled automatically. To set the hilitedButton of a group see the hilitedButton, hilitedButtonID, and hilitedButtonName properties in the Dictionary.