[Fxruby-users] FTTreeLike problems
Status: Inactive
Brought to you by:
lyle
From: Will M. <wi...@co...> - 2003-12-17 04:05:08
|
Joel, (and everyone else) I have been trying out the Treelike stuff in your new Foxtails release. The first problem I noticed is that your fancy tree example requires rbtree which does not have a windows version. Since I don't feel up to trying to figure out how to make it work on windows, I can't test it. The second problem seems a little more aggravating. Using the tree.rb example I am creating a tree list on one window. Everything works fine for the stuff that I add inside the create methods. The problem comes when I try to add a new node after the create process is complete. I get a error message that reads: Please report this bug: This FXTreeItem * already released In Observer when value of variable `child_joins_parent' matched pattern Object In Observer when value of variable `tree' matched pattern Object In Observer when value of variable `targetObject' matched pattern Object (Note that the last two things listed are variable names in my program, but the first is not and I can't make sense of any of it.) I can change various things and get various different variations on that error message, but I can't get it to work. How should this work? PS, I am including some code below. This will look familiar, but it has the FTTree stuff added. -- Will Will Merrell Personal Coach wi...@co... Coaching Life - Helping you live your dreams. http://www.coaching-life.com ==================== begin code ==================== #!/usr/bin/env ruby require 'fox' require 'fox/responder' require 'fox/colors' require 'observable' require 'foxtails' require 'foxtails/icons' require 'foxtails/treelike/array-tree' require 'rasautilities' include Fox include Observable include FoxTails class ObjectInspector include Responder extend Observable observable :current_node, :tree, :item_name def initialize(app, proj) @targetObject = nil createWindow(app, proj) end def createWindow(app, proj) @app = app @project = proj @projectName = proj.projectName @inspectordlg = FXDialogBox.new(app, "Object Inspector", DECOR_BORDER|DECOR_RESIZE|DECOR_TITLE, 0, 0, 150, 300, 0, 0, 0, 0) # Contents contents = FXHorizontalFrame.new(@inspectordlg, LAYOUT_SIDE_TOP|FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 0, 0, 0, 0) # Switcher @tabbook = FXTabBook.new(contents, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT, 0, 0, 0, 0, 2, 2, 1, 1) @tabObjectList = FXTabItem.new(@tabbook, " &Objects ", nil) outerFrame = FXVerticalFrame.new(@tabbook, LAYOUT_SIDE_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 2, 0) @innerFrame = FXVerticalFrame.new(outerFrame, FRAME_THICK|FRAME_SUNKEN|LAYOUT_SIDE_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 2, 0) FTTreeList.new(@innerFrame, 0, self, :tree, :current_node, (FRAME_SUNKEN|FRAME_THICK| LAYOUT_FILL_X|LAYOUT_FILL_Y|TREELIST_EXTENDEDSELECT| TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES)) self.tree = ArrayTree.new @objectRoot = tree.add_root(tree.make_node(@projectName)) tree.add_node(tree.make_node("child 1"), @objectRoot) @tabProperty = FXTabItem.new(@tabbook, " &Properties ", nil) @propertyFrame = FXVerticalFrame.new(@tabbook, LAYOUT_SIDE_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 2, 1) @propertyMatrix = FXMatrix.new(@propertyFrame, 2, FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y|MATRIX_BY_COLUMNS|LAYOU T_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0) FXLabel.new(@propertyMatrix, "Property", nil, FRAME_THICK|LAYOUT_FIX_WIDTH|LAYOUT_LEFT, 0, 0, 75, 0, 0, 0, 1, 1) FXLabel.new(@propertyMatrix, "Value", nil, FRAME_THICK|LAYOUT_FILL_COLUMN|LAYOUT_FILL_X, 0, 0, 0, 0, 2, 2, 1, 1) FXLabel.new(@propertyMatrix, "Type", nil, LAYOUT_FIX_WIDTH|LAYOUT_LEFT, 0, 0, 75, 0) @tabEvent = FXTabItem.new(@tabbook, " &Events ", nil) @eventFrame = FXVerticalFrame.new(@tabbook, LAYOUT_SIDE_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 2, 1) @eventMatrix = FXMatrix.new(@eventFrame, 2, FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y|MATRIX_BY_COLUMNS|LAYOU T_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0) FXLabel.new(@eventMatrix, "Event", nil, FRAME_THICK|LAYOUT_FIX_WIDTH|LAYOUT_LEFT, 0, 0, 75, 0, 2, 2, 1, 1) FXLabel.new(@eventMatrix, "Value", nil, FRAME_THICK|LAYOUT_FILL_COLUMN|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 2, 2, 1, 1) FXLabel.new(@eventMatrix, "Type", nil, LAYOUT_FIX_WIDTH|LAYOUT_LEFT, 0, 0, 75, 0) end def clear() @propertyMatrix.each_child {|child| child.retarget(nil) if child.class.name =~ /FoxTails/ } @eventMatrix.each_child {|child| child.retarget(nil) if child.class.name =~ /FoxTails/ } @propertyMatrix.hide @eventMatrix.hide @propertyFrame.removeChild(@propertyMatrix) @eventFrame.removeChild(@eventMatrix) end def addPropertyElement(title, obj, var) FXLabel.new(@propertyMatrix, title, nil, (LAYOUT_FIX_WIDTH|LAYOUT_LEFT|LAYOUT_SIDE_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FIL L_ROW), 0, 0, 75, 0) FTTextField.new(@propertyMatrix, 17, obj, var, (LAYOUT_FILL_X|FRAME_SUNKEN|LAYOUT_FILL_COLUMN)) end def addEventElement(title, obj, var) FXLabel.new(@eventMatrix, title, nil, LAYOUT_FIX_WIDTH|LAYOUT_LEFT, 0, 0, 75, 0) FTTextField.new(@eventMatrix, 17, obj, var, (LAYOUT_FILL_X|FRAME_SUNKEN|LAYOUT_FILL_COLUMN)) end def set(newobj) @targetObject = newobj @propertyMatrix = FXMatrix.new(@propertyFrame, 2, FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y|MATRIX_BY_COLUMNS|LAYOU T_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0) FXLabel.new(@propertyMatrix, "Property", nil, FRAME_THICK|LAYOUT_FIX_WIDTH|LAYOUT_LEFT, 0, 0, 75, 0, 0, 0, 1, 1) FXLabel.new(@propertyMatrix, "Value", nil, FRAME_THICK|LAYOUT_FILL_COLUMN|LAYOUT_FILL_X, 0, 0, 0, 0, 2, 2, 1, 1) FXLabel.new(@propertyMatrix, "Type", nil, LAYOUT_FIX_WIDTH|LAYOUT_LEFT, 0, 0, 75, 0) unless(@targetObject.nil?) FXLabel.new(@propertyMatrix, @targetObject.objName, nil, LAYOUT_FILL_COLUMN) @targetObject.properties.sort.each {|a| addPropertyElement(a[0], @targetObject, a[1]) } end @eventMatrix = FXMatrix.new(@eventFrame, 2, FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y|MATRIX_BY_COLUMNS|LAYOU T_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0) FXLabel.new(@eventMatrix, "Event", nil, FRAME_THICK|LAYOUT_FIX_WIDTH|LAYOUT_LEFT, 0, 0, 75, 0, 2, 2, 1, 1) FXLabel.new(@eventMatrix, "Value", nil, FRAME_THICK|LAYOUT_FILL_COLUMN|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 2, 2, 1, 1) FXLabel.new(@eventMatrix, "Type", nil, LAYOUT_FIX_WIDTH|LAYOUT_LEFT, 0, 0, 75, 0) unless(@targetObject.nil?) FXLabel.new(@eventMatrix, @targetObject.objName, nil, LAYOUT_FILL_COLUMN) @targetObject.events.sort.each {|a| addEventElement(a[0], @targetObject, a[1]) } end @inspectordlg.create @inspectordlg.show @inspectordlg.recalc end def addObject(o) p o.objName # @tree.add_node(@tree.make_node("child 1"), @objectRoot) end # Close the Inspector Windows def close @app.reg().writeIntEntry("#{@projectName}_Inspector", "x", @inspectordlg.getX-4) @app.reg().writeIntEntry("#{@projectName}_Inspector", "y", @inspectordlg.getY-30) @app.reg().writeIntEntry("#{@projectName}_Inspector", "width", @inspectordlg.width) @app.reg().writeIntEntry("#{@projectName}_Inspector", "height", @inspectordlg.height) @inspectordlg.hide end # Create and show the main window def create # Get size, etc. from registry xx = @app.reg().readIntEntry("#{@projectName}_Inspector", "x", 20) yy = @app.reg().readIntEntry("#{@projectName}_Inspector", "y", 30) ww = @app.reg().readIntEntry("#{@projectName}_Inspector", "width", 100) hh = @app.reg().readIntEntry("#{@projectName}_Inspector", "height", 400) # Reposition window to specified x, y, w and h @inspectordlg.position(xx, yy, ww, hh) # Create the windows @inspectordlg.create @inspectordlg.show(PLACEMENT_DEFAULT) end end ===================== end code ===================== |