Class: CWM::CheckBox

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

Overview

A CheckBox widget. The AbstractWidget#label method is mandatory.

Instance Attribute Summary

Attributes inherited from AbstractWidget

#handle_all_events, #widget_id

Instance Method Summary collapse

Methods included from ValueBasedWidget

#value, #value=

Methods inherited from AbstractWidget

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

Instance Method Details

#checkvoid

This method returns an undefined value.

Checks the box



141
142
143
# File 'library/cwm/src/lib/cwm/common_widgets.rb', line 141

def check
  self.value = true
end

#checked?Boolean

Returns true if the box is checked

Returns:

  • (Boolean)

    true if the box is checked



128
129
130
# File 'library/cwm/src/lib/cwm/common_widgets.rb', line 128

def checked?
  value == true
end

#uncheckvoid

This method returns an undefined value.

Unchecks the box



147
148
149
# File 'library/cwm/src/lib/cwm/common_widgets.rb', line 147

def uncheck
  self.value = false
end

#unchecked?Boolean

Returns true if the box is unchecked

Returns:

  • (Boolean)

    true if the box is unchecked



133
134
135
136
137
# File 'library/cwm/src/lib/cwm/common_widgets.rb', line 133

def unchecked?
  # explicit check as the value can be also nil,
  # which is shown as a grayed-out box, with "indeterminate" meaning
  value == false
end