Class: Watobo::Gui::TestGui

Inherits:
FXMainWindow
  • Object
show all
Defined in:
lib/watobo/gui/checkboxtree.rb

Defined Under Namespace

Classes: TreeDlg

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ TestGui

Returns a new instance of TestGui.



344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/watobo/gui/checkboxtree.rb', line 344

def initialize(app)
  # Call base class initializer first
  super(app, "Test Application", :width => 800, :height => 600)
  frame = FXVerticalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE)

  elements = []
  num_root_nodes = 4
  max_child_nodes = 4
  num_root_nodes.times do |ri|
    max_child_nodes.times do |si|
      name = "root#{ri}|sub#{si}"
      data = name + "-data"
      e = { :name => name, :enabled => false, :data => data }
      elements << e
    end
  end

  @cbtree = CheckBoxTreeList.new(frame)
  @cbtree.elements = elements

  FXButton.new(frame, "Select All",:opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT).connect(SEL_COMMAND){ @cbtree.checkAll }
  FXButton.new(frame, "Deselect All",:opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT).connect(SEL_COMMAND){ @cbtree.uncheckAll }

  FXButton.new(frame, "Open TreeDialog",:opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT).connect(SEL_COMMAND){
    dlg = TreeDlg.new(self)
    if dlg.execute != 0 then
      puts "* Dialog Finished"
    else
      puts "Dialog Canceled"
    end
  }

  FXButton.new(frame, "Exit",:opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT).connect(SEL_COMMAND){ leave }
end

Instance Method Details

#createObject



379
380
381
382
# File 'lib/watobo/gui/checkboxtree.rb', line 379

def create
  super                  # Create the windows
  show(PLACEMENT_SCREEN) # Make the main window appear
end

#leaveObject



337
338
339
340
341
342
# File 'lib/watobo/gui/checkboxtree.rb', line 337

def leave
  d = @cbtree.getCheckedData
  #puts d.class
  #puts d
  exit
end