ex.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
$FORM Metacommand and WindowState Property Example
                        Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
' This example hides a dialog box (Form2) when the parent form (Form1) is
' minimized and redisplays the dialog box when the parent form is returned to
' either a normal or maximized state. The $FORM metacommand is used to share
' Form2 properties.
 
' To try this example:
' 1. Choose New Project from the File menu
' 2. Choose New Form from the File menu to create two forms (Form1 and Form2)
' 3. Press Alt+F4 to return to the programming environment
' 4. Copy the code example below to the form module
' 5. Press F5 to run the example
 
' $FORM Form2       ' Metacommand used to share Form2 properties
 
 SUB Form_Load ()
    Form1.SHOW
    Form2.SHOW
 END SUB
 
 SUB Form_Resize ()
     CONST MIN = 1
     STATIC Pstate AS INTEGER
     IF Form1.WindowState = MIN THEN     ' If parent form is minimized,
         Pstate = Form2.Visible          ' save state of Form2,
         Form2.Visible = 0               ' hide Form2.
     ELSE                                ' If parent form is not minimized,
         Form2.Visible = Pstate          ' restore Form2 to previous state.
     END IF
 END SUB