Hi All, As simply as I can put it, the treeVirtual selection for right click context menus doesn't work correctly the first time you hit the right click on the tree. Once you have selected any row in the tree, the next time you right click on another row the selection is first moved and then the context menu is displayed. However, the first time you do this, the selection is not activated (or moved) but the context menu is displayed.
A normal table works properly for the first and subsequent times using the right click to both select and display the context menu. The easiest way to see this is if you have another widget to click on so that you can take the focus away from the tree view, and then right click again back to the tree view. I've put together a very simple playground application (see below) that demonstrates this. Use just the right-click to bounce back and forth between the tree and the table, and you'll see that the table always selects and then brings up the context menu, but the tree will bring up the context menu without updating or activating the selection. Also note that the treeVirtual works properly in IE7, but not in FF3 or Chrome. I've submitted http://bugzilla.qooxdoo.org/show_bug.cgi?id=2021 for this, and have also added this playground code to the bug: ////// BEGIN COPY HERE var win = new qx.ui.window.Window("First Window"); win.setWidth(600); win.setHeight(400); win.setShowMinimize(false); this.getRoot().add(win, {left:20, top:20}); win.setLayout(new qx.ui.layout.VBox() ); // some mechanics first. var splitpane = new qx.ui.splitpane.Pane("horizontal"); var left = new qx.ui.container.Composite(new qx.ui.layout.VBox); var right = new qx.ui.container.Composite(new qx.ui.layout.VBox); splitpane.add(left); splitpane.add(right); win.add(splitpane, {flex:1}); // Put a table in the left side: var tableModel = new qx.ui.table.model.Simple(); tableModel.setColumns(["one", "two", "three"]); var table = new qx.ui.table.Table(tableModel); left.add(table, {flex:1}); var tableData = [ ["row 1", "", ""], ["row 2", "", ""] ]; tableModel.setData( tableData ); // Put a tree-virtual on the right side: var tree = new qx.ui.treevirtual.TreeVirtual(["one", "two", "three"]); tree.setAlwaysShowOpenCloseSymbol(true); tree.getDataRowRenderer().setHighlightFocusRow(false); tree.setFocusCellOnMouseMove(false); tree.setShowCellFocusIndicator(false); right.add(tree, {flex:1}); var root = tree.getDataModel().addBranch(null, "Node One", true); var sub1 = tree.getDataModel().addBranch(root, "Sub One", true); tree.getDataModel().setColumnData( sub1, 1, "row"); tree.getDataModel().setColumnData( sub1, 2, "one"); var sub2 = tree.getDataModel().addBranch(root, "Sub Two", true); tree.getDataModel().setColumnData( sub2, 1, "row"); tree.getDataModel().setColumnData( sub2, 2, "two"); tree.getDataModel().setData( ); // Add a context menu to the table var table_context = new qx.ui.menu.Menu; var cmd1 = new qx.event.Command(); cmd1.addListener('execute', function(){alert("Table Context 1");}, this ); table_context.add( new qx.ui.menu.Button("Table Context 1", null, cmd1) ); var cmd2 = new qx.event.Command(); cmd2.addListener('execute', function(){alert("Table Context 2")}, this ); table_context.add( new qx.ui.menu.Button("Table Context 2", null, cmd2) ); table.setContextMenu( table_context); // Add a context menu to the tree var tree_context = new qx.ui.menu.Menu; var cmd3 = new qx.event.Command(); cmd3.addListener('execute', function(){alert("Tree Context 1")}, this ); tree_context.add( new qx.ui.menu.Button("Tree Context 1", null, cmd3) ); var cmd4 = new qx.event.Command(); cmd4.addListener('execute', function(){alert("Tree Context 2")}, this ); tree_context.add( new qx.ui.menu.Button("Tree Context 2", null, cmd4) ); tree.setContextMenu( tree_context ); // finally open the window to display the app win.open(); ////// END COPY HERE -- Sincerely, Mr. Hericus [email protected] http://www.hericus.com ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
