How to Disable Horizontal Scroll bar in ComboBox in SWT

感情迁移 提交于 2019-12-11 12:13:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!