Class: FX::RadioGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/libGUIb16.rb,
lib/libGUIb14.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRadioGroup

Returns a new instance of RadioGroup.



329
330
331
332
# File 'lib/libGUIb16.rb', line 329

def initialize
  @radio_widgets = []
  @selected = nil
end

Instance Attribute Details

#radio_widgetsObject (readonly)

Returns the value of attribute radio_widgets.



333
334
335
# File 'lib/libGUIb16.rb', line 333

def radio_widgets
  @radio_widgets
end

#selectedObject (readonly)

Returns the value of attribute selected.



352
353
354
# File 'lib/libGUIb16.rb', line 352

def selected
  @selected
end

Instance Method Details

#add_radio(radio_widget, &block) ⇒ Object Also known as: <<



334
335
336
337
338
339
340
# File 'lib/libGUIb16.rb', line 334

def add_radio(radio_widget, &block)
  @radio_widgets << radio_widget
  radio_widget.connect(Fox::SEL_COMMAND) {
    select(radio_widget)
    yield if block
  }
end

#select(radio_widget) ⇒ Object



342
343
344
345
346
347
348
349
350
# File 'lib/libGUIb16.rb', line 342

def select radio_widget
  @selected = radio_widget
  event_selected @selected
  @radio_widgets.each do |w|
    w.state = (w == @selected) # only the selected widget is checked.
  rescue Exception
    puts $!
  end
end