On Fri, Jan 21, 2011 at 04:05, Peter Schneider <[email protected]>wrote:

> On 1/20/2011 5:22 PM Derrell Lipman wrote:
> > On Thu, Jan 20, 2011 at 11:09, Peter Schneider <[email protected]
> >wrote:
> >
> >> Hi Derrell,
> >>
> >>> [...]
> >>> You saw that I incorporated your suggestions into trunk yesterday,
> right?
> >>> Those three should all be fixed now.
> >>> [...]
> >> Yes! Of course! And I was/am very happy about that.
> >> But I feel a bit responsible for this piece of code, now ... ;)
> >> So I thought: Give 'em some hints...(see my other post)
> >>
> >
> > Peter, your new patch does not appear to do what you want when
> incorporated
> > with yesterday's patch. This new one works perfectly initially, but as
> soon
> > as I have right-clicked on one of the existing rows, the context menu
> will
> > no longer show up on the non-row (gray) area...
> > [...]
>
> That's strange, Derrell... I've tested it here (again this morning) and it
> works. So maybe just a 'patch-problem'.
> Here's what I did:
>
> The 2nd patch (1430 Bytes sized) should be applied to Revision 24576
> (current
> HEAD) of
> /trunk/qooxdoo/framework/source/class/qx/ui/table/MTableContextMenu.js
>
> Please _do_not_ apply my first *and* second patch! "There can be only
> one"(TM)! ;)
>
> After that the Mixin should look like the one I put into the attached ZIP;
> Just to double check that the patch is applied the same way.
>
> So with that MTableContextMenu Mixin, it works on my side...


Peter, I didn't notice a patch. I saw that you'd included the entire
modified MTableContextMenu mixin (on all three of the bugs) and I created a
patch from that. I altered the result only for some "editorial" changes (I
think I added some white space at one point, or something like that). So
what's in trunk right now should be "approximately identical" :-) to what
you provided.

Unless you patched Scroller.js as well as MTableContextMenu.js, I still
contend that it can't work. Here's my testing scenario. Run this program in
the playground, using trunk:

// enhance the table
qx.Class.include(qx.ui.table.Table, qx.ui.table.MTableContextMenu);

// helping function
function createRandomRows(rowCount) {
  var rowData = [];
  for (var row = 0; row < rowCount; row++) {
    rowData.push([ row, row%2===0, Math.random() * 10000 ]);
  }
  return rowData;
}

// window
var win = new qx.ui.window.Window("Table").set({
  layout : new qx.ui.layout.Grow,
  contentPadding : 0
});
this.getRoot().add(win);
win.moveTo(30, 40);
win.open();

// table model
var tableModel = new qx.ui.table.model.Simple().set({
  columns : [ "ID", "Show Menu", "A number" ],
  data : createRandomRows(10)
});

// table
var table = new qx.ui.table.Table(tableModel);
table.setContextMenuHandler(1, function (col, row, table, dataModel,
contextMenu) {
  contextMenu.add(new qx.ui.menu.Button("row "+row,
"icon/16/actions/go-bottom.png"));
  contextMenu.add(new qx.ui.menu.Button("col "+col,
"icon/16/actions/go-last.png"));
  if (row === null)
  {
    return true;
  }
  return row%2===0; // only show on even row numbers
});
//table.setShowMenuOnEmptyRows(false);
win.add(table);

// table column model
var tcm = table.getTableColumnModel();
tcm.setDataCellRenderer(1, new qx.ui.table.cellrenderer.Boolean);


Notice that I've added a new comparison to the context menu handler, to
handle the case where the row is null. This will occur when you right-click
in the gray area of the table, below the data rows.

Now right-click on the gray area (below column 1, the second column). You'll
get the context menu. Then right-click on a data row, in column 1. If your
right-click is on an even row, you'll get the context menu; odd row, not.
Now again right-click in the gray area. The context menu will not appear.
The reason is because in the _onContextMenu function in Scroller.js, it
checks for whether the saved _lastMouseDownCell row and column match the
current row and column, and does not fire the event if those don't match.
The value of _lastMouseDownCell is only updated when clicking on a data row,
so the row value of null does not match the row value saved in
_lastMouseDownCell, which was whatever row you of data you last
right-clicked on.

So right now, we have a situation where the gray area context menu can
happen sometimes, and not other times. That's bad. Martin can solve his
problem (for now) by doing as I did in my playground example, and test for
row===null, returning false if it is. Peter, your desire to have the the
context menu available seems not to work at present... unless you've made
other changes that I don't know about.

Derrell
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to