SWT: Table lost selection

被刻印的时光 ゝ 提交于 2019-12-24 19:47:15

问题


I have a Table like below, but when table lost focus (click some button for example), selection lost too. How to avoid this ?

Table table = new Table(group, SWT.BORDER | SWT.FULL_SELECTION);
table.setLinesVisible(true);
table.setHeaderVisible(true);

table.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent arg0) {
        onSelection();
    }
});

row selected:

selection lost:


回答1:


Ahh, so your table does not show the selected row when the table does not have focus? That is a well known problem in several different editions of Windows.

Please Note: It is not a SWT problem, but simply the way some editions of Windows work!!




回答2:


You can change the background and foreground colour of the selected table item. See here Highlighting swt table row on focus lost



来源:https://stackoverflow.com/questions/10549842/swt-table-lost-selection

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!