Grouped radio button - driving me nuts

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
JackieBlue
Posts: 32
Joined: Sun Jun 22, 2014 2:37 am

Grouped radio button - driving me nuts

Post by JackieBlue » Sat Aug 02, 2014 5:42 am

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?

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: Grouped radio button - driving me nuts

Post by sefrojones » Sat Aug 02, 2014 5:48 am

Try this in the group script:

Code: Select all

on mouseup
answer the target
end mouseup

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

Re: Grouped radio button - driving me nuts

Post by Klaus » Sat Aug 02, 2014 11:47 am

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! :D


Best

Klaus

JackieBlue
Posts: 32
Joined: Sun Jun 22, 2014 2:37 am

Re: Grouped radio button - driving me nuts

Post by JackieBlue » Sat Aug 02, 2014 2:29 pm

Thanks Klaus and others. Too many years of VB, and C.

JackieBlue
Posts: 32
Joined: Sun Jun 22, 2014 2:37 am

Re: Grouped radio button - driving me nuts

Post by JackieBlue » Sun Aug 03, 2014 2:31 am

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.

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

Re: Grouped radio button - driving me nuts

Post by dunbarx » Sun Aug 03, 2014 3:08 am

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

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

Re: Grouped radio button - driving me nuts

Post by Klaus » Sun Aug 03, 2014 11:20 am

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! 8)


Best

Klaus

JackieBlue
Posts: 32
Joined: Sun Jun 22, 2014 2:37 am

Re: Grouped radio button - driving me nuts

Post by JackieBlue » Sun Aug 03, 2014 4:02 pm

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.

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

Re: Grouped radio button - driving me nuts

Post by Klaus » Sun Aug 03, 2014 5:11 pm

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? 8)

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 :D

Post Reply