Using a Script to Fill a Selection List

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 EventInitialize event to fill a selection list with the selection terms and the related return values displayed in the user dialog box, using a script. Use the controls ComboBox and ListBox to define a selection list in the user dialog box.

Note  You also can fill selection lists with selection terms when you create a user dialog box in the dialog editor. Select ListItems on the Properties tab.

Complete the following steps to fill a selection list with the texts read from an ASCII file, using a script:

  1. Select the DIAdem SCRIPT panel.

  2. Select File»New»User Variables.

  3. Delete the contents of the file and enter or copy the following text in the script editor:

    This file
    selection terms
    can be
    in a ComboBox
    in a ListBox.
  4. Select File»Save As, select the All files(*.*) file type and save the file as Combo.asc

  5. Select Edit»Create Dialog Box.

  6. Select View»Catalog.

  7. Click the OK and Cancel control group in the Catalog window and click and drag the group into the dialog box.

  8. Click the ComboBox control on the Controls bar. 

  9. Drag open the control in the dialog box.

  10. Click ... in the EventInitialize field on the Events tab. ComboBox1 must be selected.

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

    Sub ComboBox1_EventInitialize(ByRef This)
      Dim i, intMyHandle, strMyText, intMyError
      Call This.Items.RemoveAll            
      i = 1
      intMyHandle = TextFileOpen(ScriptWritePath&"Combo.asc",eTextFileAttributeRead) ' open file
      Do While Not TextFileEOF(intMyHandle)     ' as long as file contains texts 
        strMyText = TextFileReadLn(intMyHandle) ' read text from file 
        Call This.Items.Add(strMyText, i)       ' create another entry
        i = i + 1
      intMyError = TextFileClose(intMyHandle)   ' close file
    End Sub
  12. Select File»Save As and save the file as Test.sud.

  13. Select View»Test in DIAdem.

  14. Open the selection list. The selection list contains all the texts that are located in the Combo.asc file.

  15. Close the user dialog box in DIAdem.

  16. Close the dialog editor.


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


Not Helpful