简体   繁体   English

当窗口模式=“模态”时如何使窗口可见=“假”

[英]How to make a window visible=“false” when window mode=“modal”

<window title="My First Window" border="normal" width="200px" visible="false" mode="modal">
Hello, World!
</window>

When running this example i expect that there is no popUp window shown as visible="false" .... 运行此示例时,我希望没有弹出窗口显示为visible =“ false”...。

But i do get a popUp ... what am i missing ? 但是我确实弹出了……我想念什么?

When i remove mode="modal" it runs fine. 当我删除mode="modal"它运行良好。 So how do we control visible property on window with mode = "model" 那么我们如何使用mode =“ model”控制窗口上的可见属性

Zk fiddle example Zk小提琴示例


Why i want to do the above described; 为什么我要进行上述操作;
I am following the mvvm model so when something happens in app i want to show a popup by just making the popup window visible that is why i want to create a modal window that is immediately dismissed and show it later 我正在遵循mvvm模型,因此当应用中发生某些事情时,我想通过仅使弹出窗口可见来显示弹出窗口,这就是为什么我想创建一个modal窗口并立即将其关闭并稍后显示的原因

Gut feeling is that what you're asking doesn't make sense. 直觉是您的要求没有道理。 A modal window must have focus and must be dismissed before you can move on. 模态窗口必须具有焦点,并且必须先将其关闭,然后才能继续。 So if it's there, how can it not be visible? 因此,如果它在那里,怎么会不可见?

I think rather than showing a Modal Window I will suggest use Notification 我认为与其显示模式窗口,不如建议使用通知

Clients.showNotification(msg); // display a global notification box
Clients.showNotification(msg, component); // display a notification box pointing to a component

And in your code use code like this and see what will happen 在您的代码中使用这样的代码,看看会发生什么

<window title="My First Window" border="normal" width="200px"  mode="modal" visible="false">
Hello, World!
</window>
<window id="win" visible="false">

</window>

when u need your window to be visible just do: 当您需要您的窗口可见时,请执行以下操作:

win.doModal(); win.doModal();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM