From: 7stud -- Date: 2008-02-13T02:53:08+09:00 Subject: Re: get active selection from tk iwidgets radiobox Unwen wrote: > Hi there, > I have created a radiobox with various entries and want to read the > currently selected entry. > For some reason I can't get it to work. > From what I see "get" would be the appropriate method but it expects > an argument, which seems odd to me as it should return the active > entry. > > Any help? > Thanks > > Stefan I can't test this because my tk installation no longer works, but you need to: 1) Create a TkVariable, e.g. val = TkVariable.new 2) Create your radio button with the 'variable' option set to the TkVariable, e.g. variable val 3) ...and set the 'value' option of each radio button to a unique value, e.g. value 1 Thereafter, when a radio button is checked, ruby will automatically assign the value attribute of the radio button to the TkVariable. You can determine which radio button is checked by checking the value of the TKVariable. If you want to programmatically set a radio button to checked, then assign the value of the radio button to the TkVariable. -- Posted via http://www.ruby-forum.com/.