Setting focus cell in TableViewer
编程技术  /  houtizong 发布于 3年前   116
I would like to find a way to set focus to a cell in a multi-column table
by an internal Process other than the activation events listed in the code
below. One would expect that the setFocusCell(viewerCell) from
TableViewerFocusCellManager from SWTFocusCellManager would get the job
done, but it is not visible.
Suggestions for setting focus and highlighting a cell based on an internal
event?
Here's the set-up code for the TableViewer and related entities:
tableViewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION); final Table table = tableViewer.getTable(); final TableViewerFocusCellManager mgr = new TableViewerFocusCellManager(tableViewer, new FocusCellOwnerDrawHighlighter(tableViewer)); final ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(tableViewer) { @Override protected boolean isEditorActivationEvent (ColumnViewerEditorActivationEvent event) { return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION || event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && (event.keyCode == SWT.CR || event.character == ' ') || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC; } }; TableViewerEditor.create(tableViewer, mgr, actSupport, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION); TableViewerColumn column; final int[] styles = { SWT.LEAD, SWT.LEAD, SWT.LEAD, SWT.LEAD, SWT.LEAD, SWT.LEAD, SWT.LEAD}; for (int columnIndex = 0; columnIndex columnIndex++) { column = new TableViewerColumn(tableViewer, styles[columnIndex]); // etc. for each column, specifying setLabelProvider and setEditingSupport
请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!
技术博客集 - 网站简介:
前后端技术:
后端基于Hyperf2.1框架开发,前端使用Bootstrap可视化布局系统生成
网站主要作用:
1.编程技术分享及讨论交流,内置聊天系统;
2.测试交流框架问题,比如:Hyperf、Laravel、TP、beego;
3.本站数据是基于大数据采集等爬虫技术为基础助力分享知识,如有侵权请发邮件到站长邮箱,站长会尽快处理;
4.站长邮箱:[email protected];
文章归档
文章标签
友情链接