marioosh
marioosh

Reputation: 28556

SWT: Table lost selection

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: selected

selection lost: selection lost

Upvotes: 0

Views: 718

Answers (2)

Chandrayya G K
Chandrayya G K

Reputation: 8849

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

Upvotes: 0

Tonny Madsen
Tonny Madsen

Reputation: 12718

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!!

Upvotes: 1

Related Questions