如何在模态模式下打开对话框
正确的方法是什么,打开一个新对话框,以便用户在模式对话框关闭之前无法返回主窗口。
典型的模态窗口是由alert() 函数创建的。
我已经尝试过这样但没有成功:
.openWindow(null, "chrome://myapp/content/mywindow.xul","mywindow",
"chrome,centerscreen,all,modal",null);
What's the correct method, to open up a new dialog so that the user cannot return to the main window until the modal dialog is closed.
A typical modal window is created by the alert() function.
I've tried it like this without success:
.openWindow(null, "chrome://myapp/content/mywindow.xul","mywindow",
"chrome,centerscreen,all,modal",null);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您忘记提及您正在使用 nsIWindowWatcher。
为了使窗口成为模态,您需要指定它需要成为模态的窗口。如果
openWindow()
调用的第一个参数为null
,那么窗口观察程序将不知道哪个窗口打开了对话框(哪个窗口需要暂停,直到对话框被打开)。关闭)。换句话说:或更简单:
请参阅 window.openDialog()。
You forgot to mention that you are using nsIWindowWatcher.
For the window to be modal you need to specify which window it needs to be modal to. If the first parameter to your
openWindow()
call isnull
then the window watcher won't know which window opened the dialog (which window needs to be suspended until the dialog is closed). In other words:Or simpler:
See window.openDialog().