How to Use Windows Larger Than Display Size

Last reviewed: April 18, 1995
Article ID: Q106035
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, and 2.5a

SUMMARY

Windows generated with the Screen Builder that have dimensions larger than the display screen can be used effectively when they are accessed through ON KEY LABEL routines that use the MOVE WINDOW command, as shown below.

MORE INFORMATION

The ON KEY LABEL routines are created in a separate .PRG file, allowing them to be used with an unmodified existing window. If only one window is to be used, the .SPR filename can be hard-coded; if multiple windows will be used, the .SPR filename can be passed as a parameter. This example illustrates using a PARAMETERS command to pass the window name; to hard- code the window name, you can replace the variable in parentheses with the literal window name. The .SPR file is called from within the program after the ON KEY LABEL key traps are declared.

The following example uses two filenames: BIGWINDO.SPR and FOX_KROL.PRG. The BIGWINDO.SPR file is used here to represent any window defined in the Screen Builder with dimensions greater than 25 rows and 80 columns. The FOX_KROL program contains the routines to move the window relative to the display screen.

Program Assumptions

  • The .SPR file and the window name are the same.
  • The .SPR window's upper-left corner is at 0,0 (not centered).
  • At least one GET field is defined within the .SPR file.
  • The .SPR window dimensions are larger than SROW()*SCOL().
  • The .SPR file is in the same directory (if not, remove the path before moving the window).

Command-Line Syntax

   DO fox_krol WITH 'bigwindo'
   * or
   * DO fox_krol  && If window name is hard-coded.

FOX_KROL.PRG

   *: In FOX_KROL.PRG
   *:
   PARAMETERS windo     && Remove this line if window name is hard-coded.
   SET TALK OFF
   PUBLIC ROW,COL
   STORE 0 TO ROW,COL
   ON KEY LABEL alt+dnarrow DO down IN fox_krol
   ON KEY LABEL alt+uparrow DO up IN fox_krol
   ON KEY LABEL alt+rightarrow DO over IN fox_krol
   ON KEY LABEL alt+leftarrow DO back IN fox_krol

   *** FOLLOWING LINE ONLY NEEDED IF WINDOW NAME WAS PASSED IN
   **
   *
   windo=IIF('.SPR' $ UPPER(windo),windo,windo+'.spr')

   DO (windo)
   *
   ***
   **** If hard-coding the single big window name, remove both "windo"
   **** and the parentheses around it and replace them with the actual
   **** window name; do the same wherever else it is referenced below.

   ON KEY

   *:
   PROCEDURE down
   ON KEY LABEL alt+dnarrow
&& turn trap off
      IF ROW=(WROWS()-SROWS())+2
  && test limits
         ON KEY LABEL alt+dnarrow DO down IN fox_krol && reset key trap
         RETURN                                       && can't do it
      ENDIF (row=(wrow()-srow())+2)                   && already there
   MOVE WINDOW (windo) BY -1,0                        && show next row
   ROW=ROW+1                                          && update counter
   ON KEY LABEL alt+dnarrow DO down IN fox_krol       && reset key trap

   *:
   PROCEDURE up
   ON KEY LABEL alt+uparrow                           && documentation
      IF ROW=0                                        && is essentially
         ON KEY LABEL alt+uparrow DO up IN fox_krol   && the same as
         RETURN                                       && above for all
      ENDIF (row=0)
             && the routines
   MOVE WINDOW (windo) BY 1,0
   ROW=ROW-1
   ON KEY LABEL alt+uparrow DO up IN fox_krol

   *:
   PROCEDURE over
   ON KEY LABEL alt+rightarrow
   IF COL=(WCOLS()-SCOLS())+2
      ON KEY LABEL alt+rightarrow DO over IN fox_krol
      RETURN
   ENDIF (col=(wcol()-scol())+2)
   MOVE WINDOW (windo) BY 0,-1
   COL=COL+1
   ON KEY LABEL alt+rightarrow DO over IN fox_krol

   *:
   PROCEDURE back
   ON KEY LABEL alt+leftarrow
   IF COL<=0
      ON KEY LABEL alt+leftarrow DO back IN fox_krol
      RETURN
   ENDIF (col<=0)
   MOVE WINDOW (windo) BY 0,1
   COL=COL-1
   ON KEY LABEL alt+leftarrow DO back IN fox_krol


   *: EOF: FOX_KROL.PRG

When this program is run, the user can move to the portions of the screen not currently displayed by holding down the ALT key in combination with the arrow key that points in the desired direction.

To avoid requiring the user to press ALT and an arrow key, you can automatically advance the screen to the proper section by using KEYBOARD commands in the WHEN or VALID clauses of the fields to call the appropriate ON KEY LABEL routines.


Additional reference words: FoxDos 2.00 2.50 2.50a scroll
KBCategory: kbprg kbcode
KBSubcategory:


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 18, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.