Reputation: 514
I am looking for a SWT Combo
where only dropdown arrow is shown in order to save space.
I found that setting a GridData.widthHint
to the width of the arrow icon on the Combo might do the trick.
The question is how do I ask the Combo
layout the exact width of the down arrow on the Combo so that I can set that as the widthHint?
Update:
Looks like even setting the widthHint = 0
still shows part of the text field. So any other ideas would be welcome.
Upvotes: 0
Views: 713
Reputation: 111142
I don't see a way to get the drop down button width. Messing around with the width hint is likely to be very platform dependent.
An alternative would be to use code similar to the CCombo
control but without the Text
field. This uses a Button
with the SWT.ARROW | SWT.DOWN
style:
Button button = new Button(parent, SWT.ARROW | SWT.DOWN);
When the button is pressed an SWT List
control is displayed.
Upvotes: 3