如何防止弹出标题窗口后面的项目接收鼠标事件?
我有一个 Popup
皮肤 TitleWindow
,我将其用作弹出窗口,但其后面的项目正在接收鼠标悬停和单击事件。是否有一个选项可以让我防止 mouseevents 在窗口的主要内容组后面发生?
编辑:澄清一下 - 我不是问如何制作窗口模式。当用户单击 contentGroup
外观部分的区域时,弹出窗口后面的项目(不是在主窗体上,而是在侧面,而是在后面且隐藏)正在接收鼠标事件。如果用户单击该组中的项目,则不会发生这种情况,但轻微的失误可能会触发意外的背景按钮。
I have a Popup
skinned TitleWindow
that I am using as a popup, but the items behind it are receiving mouse over and click events. Is there an option that lets me prevent mousevents from happening behind the main content group of the window?
EDIT: To clarify - I'm not asking how to make a window modal. Items literally behind the popup - not on the main form but to the side, but behind and hidden - are receiving mouse events when the user clicks on an area of the contentGroup
skin part. This doesn't happen if the user clicks on items within that group, but a slight miss might trigger an unexpected background button.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
当您创建弹出设置时
modal=true
。类似于:var pop:MyPopUpClass = PopUpManager.createPopUp(parent, MyPopUpClass, true) as MyPopUpClass;
When you create the pop up set
modal=true
. Something like:var pop:MyPopUpClass = PopUpManager.createPopUp(parent, MyPopUpClass, true) as MyPopUpClass;
您需要将弹出窗口设置为模式窗口。当你制作一些模式时,这意味着窗口(Alert、popup、titleWindow 等)将保留在顶部,屏幕的其余部分将冻结,直到顶部窗口关闭。
“PopUpManager 还提供模式,以便弹出窗口下方的窗口无法接收鼠标事件,并且如果用户在窗口外单击鼠标,还提供一个事件,以便开发人员可以选择关闭窗口或警告用户。”
模态的默认值为
false
。您可以通过在addPopup
或createPopup
时传递true
将其设置为 trueYou need to make your popup window as modal window. when u make something modal, it means that window (Alert, popup, titleWindow etc) will remain at top and rest of the screen freezes till the top window closes.
"The PopUpManager also provides modality, so that windows below the popup cannot receive mouse events, and also provides an event if the user clicks the mouse outside the window so the developer can choose to dismiss the window or warn the user."
Default value of modal is
false
. you can set it to true by pasingtrue
whileaddPopup
orcreatePopup
我通过替换以下内容解决了这个问题:
用这个:
在组后面创建一个矩形对象已使其能够正常接受单击事件。
I solved this by replacing this:
With this:
Creating a rectangle object behind the group has made it so that it accepts click events normally.
如果您不是在寻找模态答案,那么我所能建议的就是在打开弹出窗口时删除所有相关侦听器,并在删除弹出窗口时将它们添加回来。
If you aren't looking for the
modal
answer, then all I can recommend is removing all relevant listeners when the popup is opened, and adding them back when the popup is removed.尝试使用 opaqueBackground 属性。
Try using the opaqueBackground property.