Progress
AppBuilder
Developer’s Guide


Layout Cases Internal Procedure

This internal procedure contains a CASE statement that has an entry for each layout in the procedure file. The CASE statement entry contains the run-time assignments for the layout. The Preprocessor reference {&LAYOUT–VARIABLE} resolves to the name of the window in the procedure file prefixed to “–layout”. Following is a sample layout case’s internal procedure. Note that the variable name {&LAYOUT–VARIABLE} is usually the same as {&WINDOW–NAME}–layout. The layout cases internal procedure is named {&LAYOUT–VARIABLE}s, which in this sample resolves to C–Win–layouts:

PROCEDURE C-Win-layouts:
  DEFINE INPUT PARAMETER layout AS CHARACTER                     NO-UNDO.
  DEFINE VARIABLE lbl-hndl AS WIDGET-HANDLE                      NO-UNDO.
  DEFINE VARIABLE widg-pos AS DECIMAL                            NO-UNDO.

  /* Copy the name of the active layout into a variable accessible to   */
  /* the rest of this file.                                             */
  C-Win-layout = layout.

  CASE layout:
    WHEN "Master Layout" THEN DO:
      ASSIGN
         &IF ’{&WINDOW-SYSTEM}’ NE ’TTY’:U &THEN
         C-Win:HIDDEN                                     = yes &ENDIF
         C-Win:HEIGHT                                     = 16.

      ASSIGN
         Btn_Done:HIDDEN IN FRAME DEFAULT-FRAME           = yes
         Btn_Done:HEIGHT IN FRAME DEFAULT-FRAME           = 1.14
         Btn_Done:ROW IN FRAME DEFAULT-FRAME              = 3.62
         Btn_Done:HIDDEN IN FRAME DEFAULT-FRAME           = no.

      ASSIGN
         Btn_Help:HIDDEN IN FRAME DEFAULT-FRAME           = yes
         Btn_Help:HEIGHT IN FRAME DEFAULT-FRAME           = 1.14
         Btn_Help:ROW IN FRAME DEFAULT-FRAME              = 3.38
         Btn_Help:HIDDEN IN FRAME DEFAULT-FRAME           = no
         Btn_Help:HIDDEN IN FRAME DEFAULT-FRAME           = no. 
      ASSIGN
         C-Win:VIRTUAL-HEIGHT                             = 16.00
         &IF ’{&WINDOW-SYSTEM}’ NE ’TTY’:U &THEN
         C-Win:HIDDEN                                     = no &ENDIF.

    END.  /* Master Layout Layout Case */

    WHEN "Standard Character":U THEN DO:
      ASSIGN
         Btn_Done:HIDDEN IN FRAME DEFAULT-FRAME           = yes
         Btn_Done:HEIGHT IN FRAME DEFAULT-FRAME           = 1
         Btn_Done:ROW IN FRAME DEFAULT-FRAME              = 4
         Btn_Done:HIDDEN IN FRAME DEFAULT-FRAME           = no NO-ERROR.

      ASSIGN
         Btn_Help:HIDDEN IN FRAME DEFAULT-FRAME           = yes
         Btn_Help:HEIGHT IN FRAME DEFAULT-FRAME           = 1
         Btn_Help:ROW IN FRAME DEFAULT-FRAME              = 3 NO-ERROR.

    END.  /* Standard Character Layout Case */

  END CASE.
END PROCEDURE.  /* C-Win-layouts */ 

This sample contains CASE statement entries for two layouts, the master layout and the standard character layout. The Btn_Help button appears in the master layout but not in the standard character layout. The master layout also sets size properties to decimal character units because a graphical environment supports fractions of a character. However, in a character environment, they are set to integer character units.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095