Modal dialog


I have a button, that on click, it displays modal dialog.

It seems that it is possible that user click very fast two times and hence, 2 modal dialogs appear.

How to make sure that once button is pressed, it can not be pressed again until first modal dialog is done?

I think you should handle this case on the server side, since there isn’t really a way for us to efficiently prevent this on the client side.

I understand. So i have to put a guaring flag or something to on_click method?

What is a nicest way to detect if something modal is shown.

I would like to have a method

void on_click()
if (MainWindow.ModalIsShown()) return;

show modal dialog;


You can get the subwindows from your mainwindow using Window.getChildWindows() so you should be able to implement that as a loop that goes through the subwindows and checks if isModal() for one of them returns true.