Page 1 of 1
Grouped radio button - driving me nuts
Posted: Sat Aug 02, 2014 5:42 am
by JackieBlue
This seems like a simple thing to do but I keep getting errors. I have two radio buttons, grouped and named "radioGroupProfit". All I want to do is to get the value (name) of selected button. I use the selected button to change a simple calculation based on the selected button. However, I am having trouble getting the selected radio button within the group. To test, I have used the following statement:
answer hilitedbuttonname of radioGroupProfit
I keep getting an error Object Expression. I have tried in pro 6.5 and community 6.7 dp 6 and get the same error. Advice?
Re: Grouped radio button - driving me nuts
Posted: Sat Aug 02, 2014 5:48 am
by sefrojones
Try this in the group script:
Code: Select all
on mouseup
answer the target
end mouseup
Re: Grouped radio button - driving me nuts
Posted: Sat Aug 02, 2014 11:47 am
by Klaus
Hi Jackie,
you used a "crippled" syntax, which cannot work because you did not address the target correctly!
If in doubt, please check the dictionary!
Code: Select all
## Bad:
## answer hilitedbuttonname of radioGroupProfit
## Good:
answer THE hilitedbuttonname of GROUP "radioGroupProfit"
You are addressing a GROUP so you need to tell LC so, and ALWAYS put object names in QUOTES!
Did I say ALWAYS!
Best
Klaus
Re: Grouped radio button - driving me nuts
Posted: Sat Aug 02, 2014 2:29 pm
by JackieBlue
Thanks Klaus and others. Too many years of VB, and C.
Re: Grouped radio button - driving me nuts
Posted: Sun Aug 03, 2014 2:31 am
by JackieBlue
Hi again Klaus. I noticed you told me to reference the Library. Perhaps I am doing something wrong, but when I look at the library, the Radio Button object is not even in the library.
Re: Grouped radio button - driving me nuts
Posted: Sun Aug 03, 2014 3:08 am
by dunbarx
Hi.
I do not see where klaus mentioned "library". But in any case, until you become more familiar with LC, keep the dictionary setting on "all". You get everything that way, including closely related words. These are valuable clues in many cases.
Also, when you do find a word that fits your needs, always look in the "see also" paragraph. Lots of opportunities there.
Craig Newman
Re: Grouped radio button - driving me nuts
Posted: Sun Aug 03, 2014 11:20 am
by Klaus
Hi Jackie,
JackieBlue wrote: I noticed you told me to reference the Library. Perhaps I am doing something wrong, but when I look at the library, the Radio Button object is not even in the library.
but "hilitedbutton" and "hilitedbuttonname" are in the dictrionary and there the correct syntax is definitively explained!
Best
Klaus
Re: Grouped radio button - driving me nuts
Posted: Sun Aug 03, 2014 4:02 pm
by JackieBlue
Yes, but why would a property be looked up? The only reason I found that property was due to another forum post. My first inclination would be to look up the object, which is not in the dictionary. I am running into a similar issue in looking up the events (messages) that can be raised. The documentation seems to be silent on a comprehensive list.
Re: Grouped radio button - driving me nuts
Posted: Sun Aug 03, 2014 5:11 pm
by Klaus
JackieBlue wrote:Yes, but why would a property be looked up?
To read how they are used in a context? Or simply to know a bit more about it?
Curiosity anyone?
Even after 15 years of working with Livecode and its ancestors I still doublecheck my syntax
against the dictioanry, when it does not work as exspected!
YMMV
