Hello !!!
What is the best way to close a modal dialog?
Greetings,
Reimon
What is the best way to close a modal dialog?
Moderators: JRL, Dorian (MJT support)
The "best" way is the way that suits the script and what you as the script author want to accomplish. The following demonstrates two easy ways to close a modal dialog.
Code: Select all
//Simple dialog block
Dialog>Dialog1
object Dialog1: TForm
Caption = 'Modal Dialog'
object MSButton1: tMSButton
Width = 75
Height = 25
Caption = 'Close'
end
end
EndDialog>Dialog1
//Dialog handler defining what to do when the button is clicked
AddDialogHandler>Dialog1,msButton1,OnClick,CloseDialog1
//Display modal dialog
//When the subroutine ends the script returns here.
Show>dialog1,res1
//Picking "X" to close the dialog bypasses the modal Show>
MessageModal>Dialog1 was closed by clicking "X"
//Subroutine to execute when the button is clicked
SRT>CloseDialog1
//Close the dialog
CloseDialog>Dialog1
MessageModal>Dialog1 was closed by clicking the button
//Reopen the dialog
Show>dialog1
END>CloseDialog1