Class: TT::GUI::Label

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

Overview

Since:

  • 2.4.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(caption, control = nil) ⇒ Label

Returns a new instance of Label

Parameters:

  • caption (String)
  • control (Control) (defaults to: nil)

    Control which receives focus when the Label is activated.

Since:

  • 2.4.0



828
829
830
831
832
833
834
835
836
837
# File 'TT_Lib2/gui.rb', line 828

def initialize( caption, control=nil )
  super
  @caption = caption
  @control = control
  @url = nil
  add_event_handler( :open_url ) {
    UI.openURL( param )
  }
  # (!) Align
end

Instance Attribute Details

#captionObject

Since:

  • 2.4.0



816
817
818
# File 'TT_Lib2/gui.rb', line 816

def caption
  @caption
end

#urlObject

Since:

  • 2.7.0



819
820
821
# File 'TT_Lib2/gui.rb', line 819

def url
  @url
end

Instance Method Details

#custom_propertiesTT::JSON

Returns:

Since:

  • 2.6.0



861
862
863
864
865
866
867
# File 'TT_Lib2/gui.rb', line 861

def custom_properties
  prop = TT::JSON.new
  prop['caption'] = @caption
  prop['control'] = @control.ui_id if @control
  prop['url'] = @url if @url
  prop
end