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, #displayed?, #enable, #enabled?, #focus, #fun_ref, #handle, #help, #init, #label, #my_event?, #opt, #refresh_help, #store, #validate, widget_type=

Instance Method Details

#checkvoid

This method returns an undefined value.

Checks the box



149
150
151
# File 'library/cwm/src/lib/cwm/common_widgets.rb', line 149

def check
  self.value = true
end

#checked?Boolean

Returns true if the box is checked.

Returns:

  • (Boolean)

    true if the box is checked



136
137
138
# File 'library/cwm/src/lib/cwm/common_widgets.rb', line 136

def checked?
  value == true
end

#uncheckvoid

This method returns an undefined value.

Unchecks the box



155
156
157
# File 'library/cwm/src/lib/cwm/common_widgets.rb', line 155

def uncheck
  self.value = false
end

#unchecked?Boolean

Returns true if the box is unchecked.

Returns:

  • (Boolean)

    true if the box is unchecked



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

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