A modal dialog box requires the user to respond to it before changing the focus to other windows within the application. The Tk command tk_dialog is designed for this purpose, and can be called in R tcltk, using the tkdialog() function. However, the method illustrated below will use the tktoplevel() function and call tkgrab.set() and tkgrab.release() explicitly, rather than relying on tkdialog() to call them automatically.
Clicking on the Launch Dialog opens our modal dialog box, i.e., you must respond to it before you can change the focus back to the main window in the Tk application.
Clicking OK gives the following message box:
When you have finished with this example, you can close win1 with: