Have a Question?
Print

00418: Obtaining information about a context in Visual PRO/5

Title:

Obtaining information about a context in Visual PRO/5

Description:

The following program demonstrates how to obtain information about the current GUI window’s context: 

0110 OPEN (100)"X0"
0120 DIM S$:TMPL(100,IND=0)
0130 LET S$=FIN(100)

After running the code, you’ll see this via a dump:

S$ TEMPLATE:
CURRENT_CONTEXT:U(2)
AVAILABLE_CONTEXT:U(2)
ACTIVE_CONTEXT_COUNT:U(2)
SCALE_X:B
SCALE_Y:B
UNITS:C(1)
SCREEN_WIDTH:U(2)
SCREEN_HEIGHT:U(2)
SCREEN_HRES:U(2)
SCREEN_VRES:U(2)
DISPLAY_TYPE:U(1)
DEVNAME:C(1*=0)
DEVTYPE:C(1*=0)
DEVMODE:C(1*=0)

This means that the screen resolution is s.screen_width by s.screen_height. Very useful if you ever want to center your forms on the screen!

Consider the following code to get the monitor resolution:

0110 OPEN (100)"X0"
0120 DIM S$:TMPL(100,IND=0)
0130 LET S$=FIN(100)
0140 PRINT FATTR(S$),'LF'
0150 PRINT S.SCREEN_WIDTH, S.SCREEN_HEIGHT, S.SCREEN_HRES,S.SCREEN_VRES

The command FATTR() provides the programmer with a list of the variables, including type that are used with the FIN() function. The programmer can then just print the variables needed.

Table of Contents
Scroll to Top