Class: Watobo::Gui::TableEditorFrame

Inherits:
FXVerticalFrame
  • Object
show all
Defined in:
lib/watobo/gui/table_editor.rb

Instance Method Summary collapse

Constructor Details

#initialize(owner, opts) ⇒ TableEditorFrame

Returns a new instance of TableEditorFrame.



442
443
444
445
446
447
448
449
450
# File 'lib/watobo/gui/table_editor.rb', line 442

def initialize(owner, opts)
  super(owner, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
  #frame = FXVerticalFrame.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
  @req_line = FXText.new(self, :opts => LAYOUT_FILL_X|TEXT_FIXEDWRAP)
  @req_line.visibleRows = 1
  @req_line.backColor = @req_line.parent.backColor
  @req_line.disable
  @editor = TableEditor.new(self, :opts => FRAME_SUNKEN|TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y|TABLE_READONLY|LAYOUT_SIDE_TOP, :padding => 2)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



452
453
454
455
456
457
458
459
460
# File 'lib/watobo/gui/table_editor.rb', line 452

def method_missing(name, *args, &block)
    
    if @editor.respond_to? name.to_sym
      return @editor.send(name.to_sym, *args, &block)
    else
      super
    end
  
end

Instance Method Details

#setRequest(raw_request) ⇒ Object Also known as: setText



425
426
427
428
429
430
431
432
433
434
435
436
437
438
# File 'lib/watobo/gui/table_editor.rb', line 425

def setRequest(raw_request)
  if raw_request.is_a? String
    request = Watobo::Utils.text2request(raw_request)
  elsif raw_request.respond_to? :copy
    request = raw_request.copy
  else
    request = Watobo::Request.new raw_request
  end
 

  @editor.setRequest request
  @req_line.text = request.first.strip unless request.empty?

end

#subscribe(event, &callback) ⇒ Object



421
422
423
# File 'lib/watobo/gui/table_editor.rb', line 421

def subscribe(event, &callback)
  @editor.subscribe event, &callback
end