Search code examples
javalistswtselected

SWT List with NO selected item


list = new List(composite, SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE);

How can i define a SWT LIST so i can DESELECT ALL the items? I have a scenario where no items must be selected at all...

The only SWT flags that seem to work are SINGLE and MULTI

Thanks.


Solution

  • I don't think there's any provision for creating a list with no selectability. If it's a display-only widget, you should probably be using a Table or a multiline Text instead.

    You could add a SelectionListener that called deselectAll(). That's a little cheesy but it would probably work.