Class: Iup::Radio

Inherits:
Widget show all
Includes:
DynamicFillMethods
Defined in:
lib/wrapped/radio.rb

Overview

A Radio container is used to group toggle controls together, so that only one out of the group will be active at a time.

To use the Radio control, place the toggle controls within a vbox/hbox and add to the radio control.

Example

This example sets up two options: Perl and Ruby. Notice the use of assign_handle in the toggles to provide a meaningful name to the radio group's current value:

perl = Iup::Toggle.new('Perl') do |t|
t.assign_handle 'perl'
end

ruby = Iup::Toggle.new('Ruby') do |t|
t.assign_handle 'ruby'
end

exclusive = Iup::Radio.new(Iup::VBox.new(perl, ruby)) do |r|
r.value = 'ruby'
end

Instance Attribute Summary

Attributes inherited from Widget

#handle

Instance Method Summary collapse

Methods included from DynamicFillMethods

#append, #insert

Methods inherited from Widget

#active, #assign_handle, #bgcolor, #destroy, #enterwindow_cb=, #fgcolor, #font, #getfocus_cb=, #help_cb=, #k_any=, #killfocus_cb=, #leavewindow_cb=, #map_cb=, #maxsize, #minsize, #open_controls, #size, #unmap_cb=, #visible, #wid, #zorder

Methods included from AttributeBuilders

#define_attribute, #define_id_attribute, #define_id_reader, #define_id_writer, #define_property_attribute, #define_property_reader, #define_property_writer, #define_reader, #define_writer

Methods included from CallbackSetter

#define_callback

Constructor Details

#initialize(toggles) {|_self| ... } ⇒ Radio

Creates an instance of the radio container. If a block is given, the new instance is yielded to it.

  • toggles - a vbox or hbox containing the toggle controls

Yields:

  • (_self)

Yield Parameters:

  • _self (Iup::Radio)

    the object that the method was called on



33
34
35
36
37
38
# File 'lib/wrapped/radio.rb', line 33

def initialize toggles
  @handle = IupLib.IupRadio(toggles.handle)

  # run any provided block on instance, to set up further attributes
  yield self if block_given?
end

Instance Method Details

#clientoffsetObject

:attr_reader: clientoffset Returns current offset of frame in its client as "widthxheight".



45
# File 'lib/wrapped/radio.rb', line 45

define_reader :clientoffset

#clientsizeObject

:attr_reader: clientsize Returns current size of frame as "widthxheight".



50
# File 'lib/wrapped/radio.rb', line 50

define_reader :clientsize

#expandObject

:attr: expand Allows container to fill available space in indicated direction. Values 'no' / 'horizontal' / 'vertical' / 'yes'.



56
# File 'lib/wrapped/radio.rb', line 56

define_attribute :expand

#positionObject

:attr_reader: position Returns position in pixels within client window as "x,y".



61
# File 'lib/wrapped/radio.rb', line 61

define_reader :position

#valueObject

:attr: value Name identifier of the active toggle.



66
# File 'lib/wrapped/radio.rb', line 66

define_attribute :value

#value_handleObject

:attr: value_handle Changes the active toggle to given name.



71
# File 'lib/wrapped/radio.rb', line 71

define_attribute :value_handle