Closing a User Dialog Box with a Script

DIAdem 2018 Help


Edition Date: June 2018
Part Number: 370858P-01
View Product Info

DOWNLOAD (Windows Only)


DIAdem 2017 Help
DIAdem 2018 Help
DIAdem 2019 Help
DIAdem 2020 Help
DIAdem 2020 SP1 Help

Use the methods OK and Cancel to close a user dialog box within a script. To create a user dialog box with three buttons that close the dialog box when they are clicked, complete the following steps.

  1. Select the DIAdem SCRIPT panel.

  1. Select Edit»Create Dialog Box.

  2. Click the Button control on the Controls bar. 

  3. Drag open the control in the dialog box.

  4. Click the column to the right of the Text field in the Properties tab and enter OK 1. Button1 must be selected.

  5. Click ... in the EventClick field on the Events tab. Button1 must be selected.

  6. Enter or copy the following text into the script editor:

    Sub Button1_EventClick(ByRef This)
      L1 = 1
      Dialog.Ok
    End Sub 
    Note  Add the above text to the lines generated automatically by the script editor.
  7. Select View»Script View.

  8. Click the Button control on the Controls bar. 

  9. Drag open the control in the dialog box.

  10. Click the column to the right of the Text field in the Properties tab and enter OK 2. Button2 must be selected.

  11. Click ... in the EventClick field on the Events tab. Button2 must be selected.

  12. Enter or copy the following text into the script editor:

    Sub Button2_EventClick(ByRef This)
      L1 = 2
      Dialog.Ok
    End Sub 
    Note  Add the above text to the lines generated automatically by the script editor.
  13. Select View»Script View.

  14. Click the Button control on the Controls bar. 

  15. Drag open the control in the dialog box.

  16. Click the column to the right of the Text field in the Properties tab and enter Cancel. Button3 must be selected.

  17. Click ... in the EventClick field on the Events tab. Button3 must be selected.

  18. Enter or copy the following text into the script editor:

    Sub Button3_EventClick(ByRef This)
      L1 = -1
      Dialog.Cancel 
    End Sub 
    Note  Add the above text to the lines generated automatically by the script editor.
  19. Select File»Save As and save the file as Test.sud.

  20. Close the dialog editor and switch to DIAdem.

  21. Select File»New»VBS Script to create a new script.

  22. Enter or copy the following text into the script editor:

    L1=0
    Do
      Call SUDDlgShow("Dlg1","Test.sud") ' display dialog box
      Select Case L1
        Case 1 Call MsgBoxDisp("OK 1 selected")
        Case 2 Call MsgBoxDisp("OK 2 selected")
        Case Else Call MsgBoxDisp("Cancel selected")
      End Select
    Loop Until (L1=-1)
  23. Select Script»Run VBS Script to start the script.

  24. Press one of the buttons in the user dialog box.

    If you press OK 1 or OK 2, DIAdem closes the dialog box, displays a message, and then redisplays the dialog box. Select Cancel to ultimately close the dialog box.

  25. Close the user dialog box in DIAdem.

Examples

Analyzing and Displaying Channels Section by Section | Checking Dialog Box Entries | Dynamic User Dialog Box | Translating User Dialog Boxes | User Dialog Box for Entering Text and Numbers | User Dialog Box for Sequence Control | User Dialog Box in DIAdem VIEW | User Dialog Box in VIEW for the Calculation of the FFT and Harmonic Frequencies | User Dialog Box with Changing Background Color | User Dialog Box with Curve Preview | User Dialog Box with Extended Table | User Dialog Box with Internet Explorer | User Dialog Box with Scalable Table | User Dialog Box with Selection Lists | User Dialog Box with Selection Lists | User Dialog Box with Subdialog Boxes | User Dialog Box with Tables | User Dialog Box with Tree | Wizard for Tolerance Evaluation

WAS THIS ARTICLE HELPFUL?

Not Helpful