DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Close dialog box from script and clear the editbox text

Solved!
Go to solution

I have a dialog box with few edit boxes (Default value is set to 0) to get numeric values from the user.

After validating the data entered, if there is an error, I pop up a message box.

I need a working code to close the dialog box and clear the edit box details and relaunch the dialog box.

 

Currently the code snippet I am using is relaunching the dialog box, but the edit box texts are retaining some value (Other than the default value expected)

0 Kudos
Message 1 of 2
(2,500 Views)
Solution
Accepted by topic author Goutu

I created 3 edit boxes and called them E1, E2, E3.  Their default values are "default 1", "default 2", "default 3".  Also a button "Button1"

'-------------------------------------------------------------------------------
Option Explicit  'Forces the explicit declaration of all the variables in a script.

'Note: In this area area you can program auxiliary variables and functions that you can use in the entire dialog box.

Sub Button1_EventClick(ByRef This) 'Created Event Handler
  If E1.Text = "1" Or E2.Text = "1" Or E2.Text = "1" Then
    Call MsgBox("Error... Restoring values")
    Call Dialog.RunInitialize()
  Else
    Call MsgBox("Good Job")
  End If
End Sub


DIM E1_TEXT, E2_TEXT, E3_TEXT
E1_TEXT = "default 1"
E2_TEXT = "default 2"
E3_TEXT = "default 3"
Sub Dialog_EventInitialize(ByRef This) 'Created Event Handler
  E1.Text = E1_TEXT
  E2.Text = E2_TEXT
  E3.Text = E3_TEXT
End Sub

If you click the button and any of the edit boxes have the text "1" (error state), the dialog box will reinitialize.

Message 2 of 2
(2,479 Views)