The AfterModalDialog event occurs after the user dismisses a modal dialog.
window_AfterModalDialog(ByVal DlgType As Long, PromptString As String, Control1String As String, Control2String As String, Control3String As String, Answer As Long)
• window – A window object.
• ByVal DlgType As Long – Returns the type of dialog displayed. The following constants specify the dialog type:
Constant |
Description |
---|---|
An ask dialog. It contains one or more buttons, and displays message text. |
|
A getstring dialog. It contains a data entry field and OK and Cancel buttons. |
• PromptString As String – The message text. Since multiple dialogs can appear for a single window, use the PromptString parameter to ascertain which modal dialog appeared.
• Control1String As String...Control3String As String – Returns the corresponding button text in the modal dialog. For getstring dialogs, Control3String returns the text the user entered in the data entry field.
• Answer As Long – A constant specifying the button the user clicked:
Constant |
Description |
---|---|
The first button in an ask dialog. |
|
The second button in an ask dialog. |
|
The third button in an ask dialog. |
|
The Cancel button in a getstring dialog. |
|
The OK button in a getstring dialog. |
The most common use of the AfterModalDialog event is when saving or deleting data objects from the Dynamic User Object Store (DUOS). For instance, if the user clicks the Delete button in the Customer Maintenance window, a modal dialog will appear, asking if the user wants to delete the customer record. Using the AfterModalDialog event, you can find out whether the user clicked the dialog’s Delete button. If so, you can delete the corresponding DUOS data object for that customer record.
The AfterModalDialog event won’t occur for all dialogs displayed in Microsoft Dynamics GP. Dialogs that display a help button and whose title is “Microsoft Dynamics GP” will function like standard window objects in your project, and will not invoke modal dialog events when displayed. |
The dtModalAskDialog constant of the DlgType parameter specifies an ask dialog. An ask dialog displays one or more buttons and message text. The following illustration shows an ask dialog and the corresponding parameters in the AfterModalDialog event:
The Answer parameter of the AfterModalDialog event returns which button the user clicked: the first, second or third button in the dialog (represented by the constants dcButton1, dcButton2 and dcButton3).
The dtModalGetStringDialog constant of the DlgType parameter specifies a getstring dialog. Getstring dialogs typically contain a message, a data entry field, and OK and Cancel buttons:
The Answer parameter of the AfterModalDialog event returns which button the user clicked: OK or Cancel (represented by the constants dcCancel and dcOK).