A grid of other controls.

Syntax

[<oRef> =] new Grid(<container> [,<name expC>])

<oRef>

A variable or property—typically of <container>—in which to store a reference to the newly created Grid object.

<container>

The container—typically a Form object—to which you’re binding the Grid object.

<name expC>

An optional name for the Grid object. If not specified, the Grid class will auto-generate a name for the object.

Properties

The following tables list the properties, events, and methods of interest in the Grid class.

Property

Default

Description

allowAddRows

true

Whether navigating down past the last row automatically calls beginAppend( )

allowColumnMoving

true

Whether columns may be moved with the mouse

allowColumnSizing

true

Whether columns may be sized with the mouse

allowDrop

false

Whether dragged objects (normally a table or table field) can be dropped in the Grid

allowEditing

true

Whether editing is allowed or the grid is read-only

allowRowSizing

true

Whether rows may be sized with the mouse

alwaysDrawCheckBox

true

Whether columnCheckBox control is painted with a checkbox for all checkbox cells in the Grid.

anchor

0 – None

How the Grid object is anchored in its container (0=None, 1=Bottom, 2=Top, 3=Left, 4=Right, 5=Center, 6=Container)

baseClassName

GRID

Identifies the object as an instance of the Grid class

bgColor

gray

Sets the background color for data displayed in grid cells, as well as the empty area to the right of the last column and below the last grid row.

cellHeight

 

The height of each cell

className

(GRID)

Identifies the object as an instance of a custom class. When no custom class exists, defaults to baseClassName

colorColumnLines

silver

Sets the color of the grid lines between the data columns

colorHighlight

WindowText/Window

Sets the text color and background color for data displayed in a grid cell that has focus. Can be overridden by setting the colorHighlight property of a GridColumn's editorControl to a non-null value.

colorNormal

WindowText/Window

Sets the text color and background color for data displayed in grid cells that do not have focus. Can be overridden by setting the colorNormal property of a GridColumn's editorControl to a non-null value.

colorRowHeader

WindowText/BtnFace

Sets the color of the indicator arrow, or plus sign, and the row header background.

colorRowLines

siilver

Sets the color of the grid lines between the data rows

colorRowSelect

HighlightText/HighLight

Sets the text color and background color for a row of data selected when the rowSelect property and/or the multiSelect property is true

columnCount

 

The number of columns in the grid

columns

 

An array of objects for each column in the grid

cuaTab

false

Whether pressing Tab follow CUA behavior and moves to next control, or moves to next cell

currentColumn

 

The number of the column that has focus in the grid

dataLink

 

The Rowset object that is linked to the grid

dragScrollRate

300

The delay time, in milliseconds, between each column scroll when dragging columns

firstColumn

1

Sets the column to be displayed in the left-most unlocked column position.

frozenColumn

 

The name of the column inside which the cursor is confined.

gridLineWidth

1

Width of grid lines in pixels (0=no grid lines)

hasColumnHeadings

true

Whether column headings are displayed

hasColumnLines

true

Whether column (vertical) grid lines are displayed

hasIndicator

true

Whether the indicator column is displayed

hasRowLines

true

Whether row (horizontal) grid lines are displayed

hasVScrollHintText

true

Whether the relative row count is displayed as the grid is scrolled vertically

headingColorNormal

WindowText/BtnFace

Sets the text color and background color for grid column heading controls

headingFontBold

true

Whether the current heading font style is Bold

headingFontItalic

false

Whether the current heading font style is Italic

headingFontName

Operating system or PLUS.ini file setting

Sets the font used to display data in a grid's headingControls

headingFontSize

10 pts.

Sets the character size of the font used to display data in a grid's headingControls

headingFontStrikeout

false

Whether to display the current heading font with a horizontal strikeout line through the middle of each character

headingFontUnderline

false

Whether the current heading font style is Underline

hScrollBar

Auto

When a horizontal scrollbar appears (0=Off, 1=On, 2=Auto, 3=Disabled)

integralHeight

false

Whether a partial row at the bottom of the grid is displayed

lockedColumns

0

The number of columns that remain locked on the left side of the grid as it is scrolled horizontally.

multiSelect

false

Whether multiple rows may be visually selected

rowSelect

false

Whether the entire row is visually selected

vScrollBar

Auto

When a vertical scrollbar appears (0=Off, 1=On, 2=Auto, 3=Disabled)

 

Event

Parameters

Description

onDragEnter

<left expN>
<top expN>
<type expC>
<name expC>

When the mouse enters the Grid display area during a Drag&Drop operation

onDragLeave

 

When the mouse leaves the Grid display area without having dropped an object

onDragOver

<left expN>
<top expN>
<type expC>
<name expC>

While the mouse drags an object over the Grid display area during a Drag&Drop operation

onDrop

<left expN>
<top expN>
<type expC>
<name expC>

When the mouse button is released over the Grid display area during a Drag&Drop operation

onFormSize

 

After the form containing the grid is resized

onSelChange

 

After moving to another row or column in the grid

 

Method

Parameters

Description

firstRow( )

 

Returns a bookmark for the row currently displayed in the first row of the grid.

getColumnObject( )

<expN>

Returns a reference to the GridColumn object for a designated column

getColumnOrder( )

 

Returns a two dimensional array for current column information

lastRow( )

 

Returns a bookmark for the row currently displayed in the last row of the grid.

refresh( )

 

Repaints the grid

selected( )

 

 

Returns an array of bookmarks for the currently selected rows in the grid

 

The following table lists the common properties, events, and methods of the Grid class:

Property

 

Event

 

Method

before
borderStyle

dragEffect

enabled

fontBold

fontItalic

fontName

fontSize

fontStrikeout

fontUnderline

form

height

helpFile

helpId

 

hWnd
id

left

name

pageno

parent

printable

speedTip

systemTheme

tabStop

top

visible

width

beforeRelease
onClose

onDesignOpen

onDragBegin

onGotFocus

onHelp
onLeftDblClick

onLeftMouseDown

onLeftMouseUp

onLostFocus

onMiddleDblClick

onMiddleMouseDown
onMiddleMouseUp

onMouseMove

onOpen

onRightDblClick

onRightMouseDown

onRightMouseUp

drag( )
move( )

release( )

setFocus( )

Description

The Grid object is a multi-column grid control for displaying the contents of a rowset. The dataLink property is set to the rowset. Columns are automatically created for each field in the rowset.

Each column is represented by a GridColumn object. If the default columns are used, these objects are hidden, and all fields are displayed. By explicitly creating a GridColumn object for each column as an element in the grid’s columns array, you may control the fields that are displayed and assign different kinds of controls in different columns.

Navigation in the rowset updates any grids that are dataLinked to the rowset, and vice versa. When you explicitly create GridColumn objects, you may set their dataLink properties to fields in other rowsets, like the fields in a linked detail table.

Grid level mouse event handlers will fire anywhere ona grid as long as the event handler is defined and is not overridden by a matching columnHeading or editorControl event. this includes mouse events on a column header, row header, grid cell, or grid background.

If you wish to have the Grid level events fire along with the editorControl or columnHeading control event, you can call the grid level event from within the editorControl or columnHeading control event handler.

 

While in Desgin Mode, if columns are defined, you can: