Reputation: 769
I have been working on an SWT project. I have a combo box whose values are set through database. I have set a fixed size for combo box but when a long string is set as an item for it, the width of combobox exceeds out of set size. I want the combo box to wrap the content by shifting the exceeding string to next line.
Here's my code:
String items[] = {"A","B","WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW","C"};
Combo combo =new Combo(comp, SWT.WRAP);
combo.setItems(items);
combo.select(0);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
combo.setLayoutData(gridData);
Upvotes: 0
Views: 685
Reputation: 1
If you are making use of the GridLayout
on the parent composite, GridData
with widthHint
can be set as layout data to the Combo control. However, dropdown/hints would still overflow the set width
Upvotes: 0
Reputation: 3085
You will not be able to achieve WRAP in SWT Combo
.
You may want to look at
http://www.eclipse.org/nebula/widgets/tablecombo/tablecombo.php
I am not sure TableCombo
supports multi line items. But you can achieve that by using OwnerDrawLabelProvider
on TableViewer
.
Upvotes: 1
Reputation: 3241
Combo
does not support SWT.WRAP
. What you are describing is not possible through any of the standard widgets. This will have to be a completely custom control.
Upvotes: 0