Reputation: 3191
When I call setItems(String[])
the combo box will become wider to fit the length of the new items.
How to make it not resizable no matter how wide the new items are?
I've tried it with ControlListener
. I saved the initial size of the combo and set it each time the controlResized()
was called. As the result the combo width remains constant but the rest of the UI looks ugly when I resize it. It is a wizard. I'm using GridLayout
Upvotes: 2
Views: 1256
Reputation: 111142
If you are using GridLayout
for your layout you can specify a widthHint
in the layout data for the combo.
GridData data = new GridData(....);
data.widthHint = 100;
combo.setLayoutData(data);
If this is in a dialog you can use convertWidthInCharsToPixels(chars)
to specify a width in characters rather than pixel. Dialog
also has a static version of this method you can use outside of a dialog.
Upvotes: 3