GRID Mnemonic - Create a Grid Control

Syntax

'GRID'(id,x,y,w,h,flags$,initrows,initcols,maxcols{,colheadheight,colheadid} {,rowheadwidth,rowheadid})

Description

For BBj-specific information, see the GRID Mnemonic - Create a Grid Control.

The 'GRID' mnemonic creates a grid control. Create grids and all other controls in resource files rather than with mnemonics. By using ResBuilder to define a grid, attributes such as column headers can be set without writing Visual PRO/5 code and changed without modifying code. All attributes of a grid can be modified at run time, including the number of rows without losing flexibility.

In versions prior to Visual PRO/5 2.10, the flag used to display vertical grid lines is $0020$. For versions PRO/5 2.10 and later, this flag is $8000$. When migrating to 2.10 from earlier versions, it is necessary to either change the $0020$ flag to $8000$ or setSETOPTSbyte 7, bit $08$.

Parameter

Description

id

A positive integer that will be used to identify the grid. This number must be unique among the controls in the current window.

x

Horizontal position of the upper-left corner of the grid in currently-scaled CONTROL units, relative to the inside of the window containing it.

y

Vertical position of the upper-left corner of the grid in currently-scaled CONTROL units, relative to the inside of the window containing it.

w

Width of the entire grid in currently scaled CONTROL units.

h

Height of the entire grid in currently scaled CONTROL units.

flags$

May be empty or a two-byte binary string composed of any hexadecimal addition of the following values:

 

Parameter Description

 

$0001$ Sets the grid control to be initially disabled.

 

$0002$ Creates a managed grid control as a column heading.

 

$0004$ Creates a managed grid control as a row heading.

 

$0008$ Allows users to resize grid columns.

 

$0010$ Sets the grid to be initially invisible. The grid can be made visible with the following command:

print(sysgui) 'show'(id)

 

$0020$ Draws vertical lines between columns in Visual PRO/5 2.0x. In Visual PRO/5 2.10 and above, use flag $8000$ to draw vertical lines. The default behavior in Visual PRO/5 2.10 and above is for this flag to do nothing. However, if the 2.10 backward compatibility SETOPTS bit (byte 7, bit $08$) is set, this flag will cause vertical lines to be drawn.

 

$0040$ Draws horizontal lines between rows.

 

$0080$ Includes a horizontal scroll bar with the control.

 

$0100$ Includes a vertical scroll bar with the control.

 

$0800$ Creates a three-dimensional recessed client edge around the control. Note that the client edge is displayed inside the control's bounding rectangle, slightly reducing the visible area of the grid.

 

$1000$ Creates a three-dimensional raised edge around the control. Note that the raised edge is displayed inside the control's bounding rectangle, slightly reducing the visible area of the grid.

 

$8000$ Draws vertical lines between columns.

 

In Visual PRO/5 versions prior to 2.10, the flag for this feature was $0020$. When migrating to 2.10 from earlier versions, it is necessary to either change the flag to $8000$ or set SETOPTS byte 7, bit $08$.

initrows

Initial number of rows in the grid.

initcols

Initial number of columns in the grid.

maxcols

Maximum number of columns the grid can contain. The number of columns can be modified at run time. Defining more columns than necessary in this parameter will waste workspace memory.

colheadheight

Optional parameter to define the height of the column headers in pixels. May only be used when flag $0004$ is turned on.

colheadid

Optional parameter to define a unique control ID for the grid that displays column headers. May only be used when flag $0004$ is turned on.

rowheadwidth

Optional parameter to define the width of the row headers in pixels. May only be used when flag $0002$ is turned on.

rowid

Optional parameter to define a unique control ID for the grid that displays row headers. May only be used when flag $0002$ is turned on.

Examples

The following code creates a grid control with ID 100 that has three rows and three columns, vertical and horizontal lines, a raised edge, and no column or row headers:

sysgui=unt; open (sysgui)"X0"
print (sysgui)'window'(0,20,550,100,"Grid Sample",$0082$,$FF$)
print (sysgui)'grid'(100,20,20,500,54,$9040$,3,3,5)
escape

The following code creates a grid control with ID 100 that has three rows and three columns, vertical and horizontal lines, a client edge, and column and row headers. Note that the bounding rectangle is larger in this example than the example above so that the grid body will display without truncation.

sysgui=unt; open (sysgui)"X0"
print (sysgui)'window'(0,20,650,120,"Grid Sample",$0082$,$FF$)
print (sysgui)'grid'(100,20,20,580,74,$8846$,3,3,5,18,101,30,102)
escape

See Also

Mnemonics - Alphabetical Listing

Mnemonics - Group Listing