ID: Q106035
The information in this article applies to:
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.
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.
DO fox_krol WITH 'bigwindo'
* or
* DO fox_krol && If window name is hard-coded.
*: 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:
Last Reviewed: April 18, 1995