WebDialog.Dismissed

From Xojo Documentation

Event


WebDialog.Dismissed()

New in 2010r4

Supported for all project types and targets.

Called when the dialog is dismissed by calling its Hide or Close methods.

Examples

Consider a dialog, MyDialog, which has a single button with this code in its Action event handler:

Self.Close

With this dialog dragged onto a web page, you can display it using this code (probably on the Action event handler of a button):

MyDialog1.Show

When the dialog is closed, the Dismissed event handler is called. This code displays a simple message to indicate it was closed:

MessageBox("Dialog is closed.")

In this event handler, you can also access properties of the dialog to check values that were entered or buttons that were pressed. For example, If there was a TextField on the dialog, you could get its value in the Dismissed event handler like this:

Var text As String
text = Me.TextField1.Text
MessageBox("Text=" + text)

Similarly, if your dialog has multiple buttons and you want to know which one was clicked, you will have to save that information into a property you can check. For example, you can add a ButtonClicked As WebButton property to the dialog. In an OK button (named OKButton), you then use this code to indicate that the OK button was pressed:

ButtonClicked = Me
Self.Close

In a Cancel button (named CancelButton), you would use the same code:

ButtonClicked = Me
Self.Close

Now when the dialog is closed, you can check the ButtonClicked property in the Dismissed event handler to see which button was used to close the dialog:

Select Case Me.ButtonClicked
Case Me.OKButton
MessageBox("OK selected.")
Case Me.CancelButton
MessageBox("Cancel selected.")
End Select