How to update the list of items in the SWT Combo box?

只谈情不闲聊 提交于 2019-12-02 04:38:25

问题


I have a UI with a Combo box. The list of items, which can be chosen, has to be refreshed every time the combo is about to open the list.

Is there any way - i.e. to add a listener which will inform UI that Combo is about to open?

Unfortunately I am not able to observe model to update the list when it changes.


回答1:


Unfortunatelly there is no such method for SWT Components. In Swing it would be easy with the help of the PopupMenuListener Interface.
A workaround I can think of would be to implement a MouseListener and a KeyboardListener (As Comboboxes can be opened by pressing 'space') so you can at least update your Combobox List when those two Events take place.



来源:https://stackoverflow.com/questions/7429895/how-to-update-the-list-of-items-in-the-swt-combo-box

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