Deselecting Text
If the user has entered text in the text field, or has selected an item causing it to be entered in the text field, he may need to remove that text or de-select the item.
How do I do that?
Deselecting an item can be done programmatically by:
c.deselectAll( );
In the case of an
SWT.DROP_DOWN
-style combo, you may also need to call
setText( )
to remove any text from the text
portion of the combo:
c.setText("");
This is the brute force approach, but it works well since
Combo
objects are single-selection.
Get SWT: A Developer's Notebook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.