如何更新SWT组合框中的项目列表? [英] How to update the list of items in the SWT Combo box?

查看:244
本文介绍了如何更新SWT组合框中的项目列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有组合框的UI。可以选择的项目列表必须在每次组合打开列表时刷新。



有没有办法 - 即添加一个监听器这将通知UI,Combo即将打开?



不幸的是,当我更改列表时,我无法观察模型。

解决方案

不幸的是,SWT组件没有这样的方法。在Swing中,这将很容易在PopupMenuListener接口的帮助下。

我可以想到的解决办法是实现一个MouseListener和一个KeyboardListener(由于可以通过按空格打开组合框),所以你当这两个事件发生时,可以至少更新您的组合框列表。


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.

解决方案

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.

这篇关于如何更新SWT组合框中的项目列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆