Every now and then, in the forums and in emails to us, there seems to be some confusion over what these terms mean. As a developer I take these terms for granted, but anyone else, depending on their walk of life, might think they refer to some kind of Modal Jazz; something to do with a modal matrix used in linear algebra; or a type of auxiliary verb used to indicate modality.
I sometimes need to remind myself that not everyone coming to Macro Scheduler and Windows Automation in general are familiar with geeky software terms. I can’t tell you much about modal jazz, linear algebra or auxiliary verbs, but I can do my best to set to rest any confusion about Modal and Non-Modal windows.
When a window is modal it remains active and focused until the user has finished with it and dismisses it. While it is active no other windows of the same application can be activated. A modal window is therefore normally a child window. The user needs to interract with it before control can be returned to the parent application. In effect the parent application is locked and nothing proceeds until the modal window is closed.
So a non-modal window is the opposite. While it is active you can still activate other windows. The user can switch between windows of the same application. The window being active does not prevent the rest of the application from continuing.
In Macro Scheduler you can create custom dialogs. These can be modal or non-modal to the script. When we refer to a modal dialog what we mean is that once the dialog is displayed, the script halts until the user closes the dialog. Script execution is paused until the dialog is dismissed. The script cannot do any processing while the modal dialog is active. A modal dialog is displayed with the Show command, with a return variable specified, in which the “modal result” of the dialog is reported, corresponding to which button was pressed to close the dialog.
A dialog can be made to be non-modal. In which case the script carries on even after it has displayed the dialog. The user can interact with the dialog while the script continues to perform other tasks. The developer would need to write code to retrieve the state of the dialog and the data that has been entered into it. Usually this would need to take place in a loop. A non-modal dialog is displayed with the Show command, with the return variable omitted. Inside the loop we would retrieve the state and data of the dialog with the GetDialogAction command, and set it with ResetDialogAction.
In this post I have concentrated on definitions rather than going into detail on how you can create and control custom dialogs. That is a subject for another post and you will find more information in the help file and online help. Some dialog examples ship with Macro Scheduler and you’ll find more in the forums.
No related posts.