ex.hlp (Topic list)
$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