Class: TT::GUI::Button

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

Overview

Events

  • :click

Since:

  • 2.4.0

Direct Known Subclasses

ToolbarButton

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(caption, &on_click) ⇒ Button

Returns a new instance of Button

Parameters:

  • caption (String)
  • on_click (Proc)

Since:

  • 2.4.0



548
549
550
551
552
553
554
555
556
557
558
559
560
# File 'TT_Lib2/gui.rb', line 548

def initialize( caption, &on_click )
  super
  # Defaults
  # http://msdn.microsoft.com/en-us/library/aa511279.aspx#controlsizing
  # http://msdn.microsoft.com/en-us/library/aa511453.aspx#sizing
  # Actual: 75x23
  # Visible: 73x21
  @width = 73
  @height = 21
  # User Properties
  @caption = caption
  add_event_handler( :click, &on_click )
end

Instance Attribute Details

#captionObject

Since:

  • 2.4.0



539
540
541
# File 'TT_Lib2/gui.rb', line 539

def caption
  @caption
end

Instance Method Details

#custom_propertiesTT::JSON

Returns:

Since:

  • 2.5.0



564
565
566
567
568
# File 'TT_Lib2/gui.rb', line 564

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