[英]How to sort config labels in natTable as well? (Is there a simple way to get relative coordinates from a nattable?)
[英]How to get the mouse position from nattable cell for rcptt testing?
当我开始研究RCPTT并在NatTable上测试上下文菜单时,它需要鼠标的x和y坐标,但是我想用单元格位置而不是鼠标的x和y位置对其进行测试。
因此,我教了如何为RCPTT编写自定义实现,以实现具有单元格位置的mose-press ecl-command。
为此,我需要在选择单元格后获取鼠标坐标。
使用EditCellCommand / SelectCellCommand选择/编辑单元格后,是否可以找到鼠标位置?
因此,我将传递自定义鼠标按下ecl-commant而不是鼠标指针的单元格位置,然后触发单元格命令并获取鼠标坐标,然后将此坐标用于鼠标按下ecl命令。
这是一个与SWT相关的问题,而不是特定于NatTable的问题。 我认为该主题已经给出了答案: 如何获得相对和绝对光标位置?
我找到了从单元格绑定中获取x和y位置的方法。
ILayerCell cell = nattable.getLayer().getCellByPosition(this.COL_ONE, this.ROW_TWO);
Rectangle bounds = cell.getBounds();
int x = bounds.x;
int y = bounds.y;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.