Class: TT::GUI::Checkbox

Inherits:
Control show all
Defined in:
TT_Lib2/gui.rb

Overview

Since:

  • 2.7.0

Instance Attribute Summary collapse

Attributes inherited from Control

#bottom, #font_bold, #font_italic, #font_name, #font_size, #height, #left, #name, #parent, #right, #tooltip, #top, #ui_id, #width, #window

Instance Method Summary collapse

Methods inherited from Control

#add_event_handler, #call_event, #disabled=, #disabled?, #enabled=, #enabled?, events, has_event?, #inspect, #move, #position, #positioned?, #properties, #release!, #size

Methods included from ControlEvents

included

Constructor Details

#initialize(label, checked = false) ⇒ Checkbox

Returns a new instance of Checkbox

Parameters:

  • label (String)

Since:

  • 2.7.0



616
617
618
619
620
# File 'TT_Lib2/gui.rb', line 616

def initialize( label, checked = false )
  super
  @label = label
  @checked = checked
end

Instance Attribute Details

#labelObject

Since:

  • 2.7.0



607
608
609
# File 'TT_Lib2/gui.rb', line 607

def label
  @label
end

Instance Method Details

#check!Boolean

Returns:

  • (Boolean)

Since:

  • 2.7.0



624
625
626
# File 'TT_Lib2/gui.rb', line 624

def check!
  checked = true
end

#checkedBoolean Also known as: checked?

Returns:

  • (Boolean)

Since:

  • 2.7.0



642
643
644
# File 'TT_Lib2/gui.rb', line 642

def checked
  @checked = self.window.get_checkbox_state( self.ui_id )
end

#checked=(value) ⇒ Boolean

Parameters:

  • value (Boolean)

Returns:

  • (Boolean)

Since:

  • 2.7.0



651
652
653
654
655
# File 'TT_Lib2/gui.rb', line 651

def checked=( value )
  @checked = value
  update_html_element( { :checked => value } )
  value
end

#custom_propertiesTT::JSON

Returns:

Since:

  • 2.7.0



669
670
671
672
673
674
# File 'TT_Lib2/gui.rb', line 669

def custom_properties
  prop = TT::JSON.new
  prop['label'] = @label
  prop['checked'] = @checked
  prop
end

#toggle!Boolean

Returns:

  • (Boolean)

Since:

  • 2.7.0



636
637
638
# File 'TT_Lib2/gui.rb', line 636

def toggle!
  checked = !checked
end

#uncheck!Boolean

Returns:

  • (Boolean)

Since:

  • 2.7.0



630
631
632
# File 'TT_Lib2/gui.rb', line 630

def uncheck!
  checked = false
end