Class: Nuklear::UI::Option

Inherits:
Checkbox show all
Defined in:
lib/nuklear/ui/option.rb

Instance Attribute Summary

Attributes inherited from Checkbox

#text

Instance Method Summary collapse

Methods inherited from Checkbox

#checked=, #checked?, #initialize

Methods inherited from Base

descendants, #dsl, inherited, #initialize

Methods included from Enableable

#disable, #disabled=, #disabled?, #enable, #enabled=, #enabled?

Methods included from Events

#event_listeners_for, #on, #trigger

Constructor Details

This class inherits a constructor from Nuklear::UI::Checkbox

Instance Method Details

#result(event, context) ⇒ Object

Override #result to prevent user deselecting this option by clicking on it. Checkbox can be deselected, option cannot. Only choosing a competing option can cause it to be deselected, and doing that does not call #result. See Nuklear::UI::OptionGroup.



12
13
14
# File 'lib/nuklear/ui/option.rb', line 12

def result(event, context)
  trigger event if event
end

#to_commandObject



4
5
6
# File 'lib/nuklear/ui/option.rb', line 4

def to_command
  [ :ui_option, text, checked? ]
end