Class: CWM::RadioButtons

Inherits:
AbstractWidget show all
Includes:
ItemsSelection
Defined in:
library/cwm/src/lib/cwm/common_widgets.rb

Overview

Note:

if radio buttons are modified during runtime, like with #change_items then handle won't work correctly unless handle_all_events specified

A selection of a value via radio buttons. The AbstractWidget#label method is mandatory.

See Also:

  • for child example

Instance Attribute Summary

Attributes inherited from AbstractWidget

#handle_all_events, #widget_id

Instance Method Summary collapse

Methods included from ItemsSelection

#change_items, #items

Methods inherited from AbstractWidget

#cleanup, #disable, #enable, #enabled?, #handle, #help, #init, #label, #opt, #store, #validate, widget_type=

Instance Method Details

#cwm_definitionWidgetHash

See AbstractWidget#cwm_definition In addition to the base definition, this honors possible `vspacing` and `hspacing` methods

Examples:

defining additional space between the options

def vspacing
  1
end

defining some margin at both sides of the list of options

def hspacing
  3
end

Returns:



312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'library/cwm/src/lib/cwm/common_widgets.rb', line 312

def cwm_definition
  additional = {}
  additional["vspacing"] = vspacing if respond_to?(:vspacing)
  additional["hspacing"] = hspacing if respond_to?(:hspacing)
  # handle_events are by default widget_id, but in radio buttons, events are
  # in fact single RadioButton
  if !handle_all_events
    event_ids = items.map(&:first)
    additional["handle_events"] = event_ids
  end

  super.merge(additional)
end

#hspacingFixnum

Returns margin at both sides of the options list

Returns:

  • (Fixnum)

    margin at both sides of the options list



290
291
292
# File 'library/cwm/src/lib/cwm/common_widgets.rb', line 290

def value
  Yast::UI.QueryWidget(Id(widget_id), :CurrentButton)
end

#valueObject



290
291
292
# File 'library/cwm/src/lib/cwm/common_widgets.rb', line 290

def value
  Yast::UI.QueryWidget(Id(widget_id), :CurrentButton)
end

#value=(val) ⇒ Object



294
295
296
# File 'library/cwm/src/lib/cwm/common_widgets.rb', line 294

def value=(val)
  Yast::UI.ChangeWidget(Id(widget_id), :CurrentButton, val)
end

#vspacingFixnum

Returns space between the options

Returns:

  • (Fixnum)

    space between the options



# File 'library/cwm/src/lib/cwm/common_widgets.rb', line 284