モーダルダイアログが閉じられるまでユーザーがメインウィンドウに戻れないように、新しいダイアログを開くための正しい方法は何ですか。
通常のモーダル ウィンドウは、alert() 関数によって作成されます。
私は成功せずにこのように試しました:
.openWindow(null, "chrome://myapp/content/mywindow.xul","mywindow",
"chrome,centerscreen,all,modal",null);
モーダルダイアログが閉じられるまでユーザーがメインウィンドウに戻れないように、新しいダイアログを開くための正しい方法は何ですか。
通常のモーダル ウィンドウは、alert() 関数によって作成されます。
私は成功せずにこのように試しました:
.openWindow(null, "chrome://myapp/content/mywindow.xul","mywindow",
"chrome,centerscreen,all,modal",null);
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 is null
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:
watcher.openWindow(mainWin, "chrome://myapp/content/mywindow.xul", "mywindow",
"chrome,centerscreen,all,modal", null);
Or simpler:
mainWin.openWindow("chrome://myapp/content/mywindow.xul", "mywindow",
"chrome,centerscreen,all,modal");
See window.openDialog().