在GWT容器中停用用户互动? [英] Disable user interaction in a GWT container?

查看:147
本文介绍了在GWT容器中停用用户互动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在复合材料(flextable)中包含的许多小部件(例如超链接,按钮等)上禁用/启用用户交互(鼠标点击)

I want to disable/enable user interaction (mouse click more specificly) on many widgets like hyperlink, button, etc which are contained in a composite (flextable)

有多个点击处理程序,我不想打扰根据模式删除和添加监听器(互动启用/禁用)

there are more than one click handlers, and I don't want to bother with removing and adding listeners according to mode (interaction enabled/disabled)

任何想法都会被认为...

Any ideas would be appriciated...

推荐答案

您忘了提及GWT的版本。在GWT 2.0中,您可以使用此代码段或类似的东西。此功能允许您在事件移交到目标窗口小部件之前取消事件。

You forgot to mention the version of GWT. In GWT 2.0 you can use this code snippet or something similar. This feature allows you to cancel events before they are handed over to the target widget.


Event.addNativePreviewHandler(new Event.NativePreviewHandler() {
                public void onPreviewNativeEvent(NativePreviewEvent pEvent) {
                    final Element target = pEvent.getNativeEvent().getEventTarget().cast();

                    // block all events targetted at the children of the composite.
                    if (DOM.isOrHasChild(getElement(), target)) {
                        pEvent.cancel();
                    }
                }
            });

这篇关于在GWT容器中停用用户互动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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