Class: TT::GUI::Listbox
Overview
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!
included
Constructor Details
#initialize(list = nil) ⇒ Listbox
Returns a new instance of Listbox
694
695
696
697
698
699
700
|
# File 'TT_Lib2/gui.rb', line 694
def initialize( list = nil )
super
@value = nil
@items = ( list.is_a?(Array) ) ? list : [] @size = nil
@multiple = false
end
|
Instance Attribute Details
#items ⇒ Object
686
687
688
|
# File 'TT_Lib2/gui.rb', line 686
def items
@items
end
|
#multiple ⇒ Object
686
687
688
|
# File 'TT_Lib2/gui.rb', line 686
def multiple
@multiple
end
|
#size ⇒ Object
686
687
688
|
# File 'TT_Lib2/gui.rb', line 686
def size
@size
end
|
#value ⇒ String
686
687
688
|
# File 'TT_Lib2/gui.rb', line 686
def value
@value
end
|
Instance Method Details
#add_item(string) ⇒ String
#add_item(string, ...) ⇒ String
721
722
723
724
725
726
727
728
729
730
|
# File 'TT_Lib2/gui.rb', line 721
def add_item( *args )
args = args[0] if args.size == 1 && args[0].is_a?( Array )
if args.size == 1
@items << args[0]
self.window.call_script( 'UI.add_list_item', self.ui_id, args[0] )
else
@items.concat( args )
self.window.call_script( 'UI.add_list_item', self.ui_id, args )
end
end
|
#custom_properties ⇒ TT::JSON
704
705
706
707
708
709
710
711
|
# File 'TT_Lib2/gui.rb', line 704
def custom_properties
prop = TT::JSON.new
prop['value'] = @value
prop['items'] = @items
prop['size'] = @size if @size
prop['multiple'] = @multiple if @multiple
prop
end
|