TableViewer:如何强制选择更改

发布于 2024-11-18 12:48:33 字数 151 浏览 5 评论 0原文

当调用tableViewer.getTable().selectAll()时,注册的选择侦听器将不会收到通知(据我所知,SWT 中所有类型的编程选择更改都是如此)。如何触发 TableViewer 的内部选择更改,以便它通知所有侦听器?

When invoking tableViewer.getTable().selectAll() the registered selection listeners will not be notified (as usual for all kind of programmatic selection changes in SWT - according to my knowledge). How can I trigger an internal selection change to the TableViewer so it notifies all listeners?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小草泠泠 2024-11-25 12:48:33

您可以这样做:

yourTableViewer.getTable().notifyListeners( SWT.Selection, null );

其中 null 是一个 Event。请记住,这是您的侦听器收到的Event

You can do this:

yourTableViewer.getTable().notifyListeners( SWT.Selection, null );

Where null is an Event. Remember that this is the Event received by your listener.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文