TreeViewer 列标题的双击事件?
我想做的就是在 JFace TreeViewer 列中添加双击排序。我可以找到自 2010 年 5 月以来在 Eclipse 论坛中提出的问题,但到目前为止还没有回复。
到目前为止我已经尝试过:
column.addListener(SWT.MouseDoubleClick, listener); // Not working, listener never called
treeViewer.addDoubleClickListener(new IDoubleClickListener(); // Work in the item, not column header
我错过了什么吗?
任何建议表示赞赏。
嘿
All I would like to do is to add double-click-to-sort at a JFace TreeViewer column. I could find the question asked in Eclipse forum since May 2010 but no response so far.
So far I have tried:
column.addListener(SWT.MouseDoubleClick, listener); // Not working, listener never called
treeViewer.addDoubleClickListener(new IDoubleClickListener(); // Work in the item, not column header
Am I missing something?
Any advice is apprecated.
Hei
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
上次我检查时,SWT 3.7 仍然无法实现这一点。与文档状态一样,
TreeColumns
和TableColumns
仅发送Move
、Resize
和Selection
事件。另外,列标题现在可以(好吧,从 3.5 左右开始)显示控件的上下文菜单。但是没有任何东西可以检测到双击列标题。既然你似乎需要这个来排序,那么它必须是双击吗?列的
Selection
事件(即单击)是执行此操作的常用方法。The last time I checked this was still not possible with SWT 3.7. Like the documentation states,
TreeColumns
andTableColumns
only sendMove
,Resize
andSelection
events. Plus, column headers can now (well, since 3.5 or so) display the control's context menu. But there's nothing to detect a double click on a column header.Since you seem to need this for sorting, does it have to be a double click? The
Selection
event (i.e. single click) of a column is the common way to do that.