Saving and Restoring the Last Dialog Box Position

DIAdem 2018 Help


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

DOWNLOAD (Windows Only)


DIAdem 2015 Help
DIAdem 2017 Help
DIAdem 2018 Help
DIAdem 2019 Help
DIAdem 2020 Help

Use the EventInitialize event to initialize the dialog box controls when the user dialog box is called. Use the EventTerminate event to trigger actions when the user dialog box closes.

Complete the following steps so that the user dialog box reads its position from the file with the same name and the file extension .pos. The user dialog box saves its current position in this file when the user dialog box closes.

  1. Select the DIAdem SCRIPT panel.

  1. Select Edit»Create Dialog Box.

  2. Select View»Catalog.

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

  4. Click the dialog box area. Make sure you do not select a control.

  5. Click ... in the EventInitialize field on the Events tab.

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

    Sub Dialog_EventInitialize(ByRef This)
      Dim a, b
      If FileX(This.FilePath & This.FileName & ".pos") Then
        a = FR(This.FilePath & This.FileName & ".pos", 1)
        a = a - This.Left 
        b = FR(This.FilePath & This.FileName & ".pos", 2)
        b = b - This.Top
    
        Call This.move(a, b)
    
        This.Height = FR(This.FilePath & This.FileName & ".pos", 3)
        This.Width  = FR(This.FilePath & This.FileName & ".pos", 4)
      End If
    End Sub 
    Note  Add the above text to the lines generated automatically by the script editor.
  7. Select View»Script View.

  8. Click ... in the EventTerminate field on the Events tab.

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

    Sub Dialog_EventTerminate(ByRef This)
      Call FileWriteLn(This.FilePath & This.FileName & ".pos", 0, This.Left)
      Call FileWriteLn(This.FilePath & This.FileName & ".pos", 1, This.Top)
      Call FileWriteLn(This.FilePath & This.FileName & ".pos", 1, This.Height)
      Call FileWriteLn(This.FilePath & This.FileName & ".pos", 1, This.Width)
    End Sub 
    Note  Add the above text to the lines generated automatically by the script editor.
  10. Select File»Save As and save the file as Test.sud.

  11. Select View»Test in DIAdem.

  12. Position the dialog box in the top left screen corner. Close the dialog box with OK or Cancel.

  13. Select View»Test in DIAdem.

    The user dialog box opens again in the top left screen corner.

  14. Close the user dialog box in DIAdem.

  15. 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