问题
I have created a combo Box but I am experiencing a strange behavior, If number of Elements in my Combobox is <= 2, I am unable to see a Horizontal scroll bar.
But if they are more than 2 then I see a horizontal scroll bar automatically pop up. What I would like is, to disable the horizontal scroll bar. This is the code I am using.
preferredResourceCombo = Components.createCombo(controlComposite, SWT.BORDER);
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
gridData.widthHint = 150;
preferredResourceCombo.setLayoutData(gridData);
preferredResourceCombo.addVerifyListener(new ComboAutoSelectVerifyListener());
// preferred resource combo modify listener at bottom of method
preferredResourceComboViewer = new ComboViewer(preferredResourceCombo);
preferredResourceComboViewer.setLabelProvider(SelectionItemLabelProvider.getInstance());
preferredResourceComboViewer.setContentProvider(ArrayContentProvider.getInstance());
I am using the same code everywhere but only here I am getting this behavior.What could be the possible causes?
回答1:
There's a bug report about this here.
Unfortunately, there is no solution so far.
来源:https://stackoverflow.com/questions/33343004/how-to-disable-horizontal-scroll-bar-in-combobox-in-swt