Creating an Extended Table

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 XTable control to create an extended table in a user dialog box. Use the events EventValSet and EventValGet to control the contents of the extended table. The user dialog box triggers the EventValSet event to save the value of a cell from the extended table. The user dialog box uses the EventValGet event to display a value in a cell of the extended table.

Complete the following steps to create a user dialog box with an extended table that contains the values of four data channels. Design the extended table so that the table cells are yellow and the edited table cell is red.

Note  For this example, delete all the data in the Data Portal and load the data file Example.tdm from the library folder.
  1. Select the DIAdem SCRIPT panel.

  1. Select Edit»Create Dialog Box.

  2. Click the XTable control on the Controls bar. 

  3. Drag open the control in the dialog box.

  4. Click the column on the right of the Columns field in the Properties tab. XTable1 must be selected.

  5. Click Add in the Configure Columns dialog box to add a <Default> type column to the extended table. The <Default> column type corresponds to the EditBox control.

  6. Click the ... button to the right of the Cell type in the <Default> area.

  7. Configure the Display control. Click the right column next to the BackColor field and select the color yellow.

  8. Click Entry control to configure the input control. Click the right column next to the BackColor field and select the color red. Click the right column next to the ForeColor field and select the color white.

  9. Click OK to close the dialog boxes.

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

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

    Sub XTable1_EventInitialize(ByRef This)
      This.RowCount = Data.GetChannel("[1]/[1]").Size ' same number of table rows as number of values in first channel
    End Sub
    Note  Add the above text to the lines generated automatically by the script editor.
  1. Select View»Script View.

  2. Click ... in the EventValGet field on the Events tab. XTable1 must be selected.

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

    Sub XTable1_EventValGet(ByRef This, Row, Col, ByRef Cell, IsInputCell)
      If Row = 0 Then              ' set title of table
        Select Case Col
        Case 0
          Cell.Text = ""           ' row with line numbers doesn't contain title
        Case Else
          Cell.Text = Data.GetChannel(Col).Name ' display channel name
        End Select 
      Else
        Select Case Col
        Case 0
          Cell.Text = Row          ' display line number
        Case Else
          Cell.Text = Str(Data.GetChannel(Col).Values(Row))  ' display channel value
        End Select 
      End If
    End Sub
    Note  Add the above text to the lines generated automatically by the script editor.
  4. Select View»Script View.

  5. Click ... in the EventValSet field on the Events tab. XTable1 must be selected.

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

    Sub XTable1_EventValSet(ByRef This, Row, Col, ByRef Cell)
      If Row > 0 And Col > 0 Then
        Data.GetChannel(Col).Values(Row) = Val(Eval(Cell.Text))  ' entered value included in channel
      End If
    End Sub
    Note  Add the above text to the lines generated automatically by the script editor.
  7. Select View»Script View.

  8. Select File»Save As and save the file as Test.sud.

  9. Select View»Test in DIAdem.

    The extended table displays the table cells in yellow. As soon as you edit a table cell, the cell appears in red.

  10. Close the user dialog box in DIAdem.

  11. Close the dialog editor.

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