@...GRID
DEFINE GRID 
Creates a grid control.
  

A control Grid is a container object that displays data in rows and columns, and is similar in appearance to a Browse window.

SYNTAX

Standard Window:

@ <nRow> ,<nCol> GRID <ControlName>
[ ID <
nId> ]
[ OF | PARENT | DIALOG <
ParentWindowName> ]
[ WIDTH <
nWidth> ]
[ HEIGHT <
nHeight> ]
[ HEADERS <
acHeaders>]
[ WIDTHS <
anWidths> ]
[ ITEMS <
acItems> ]
[ VALUE <
nValue> ]
[ FONT <
cFontname> SIZE <nFontsize> ]
[ BOLD ] [ ITALIC ] [ UNDERLINE ] [ STRIKEOUT ]
[ TOOLTIP <
cToolTipText> ]
[ BACKCOLOR <
aBackColor> ]
[ FONTCOLOR <
aFontColor> ]
[ DYNAMICBACKCOLOR <
aDynamicBackColor> ]
[ DYNAMICFORECOLOR <
aDynamicForeColor> ]
[ ON GOTFOCUS <
OnGotFocusProcedur> | <bBlock> ]
[ ON CHANGE <
OnChangeProcedure> | <bBlock> ]
[ ON LOSTFOCUS <
OnGotFocusProcedur> | <bBlock> ]
[ [ ON DBLCLICK <
OnDblClickProcedure> | <bBlock> ] | [ EDIT ] ]
[ ON HEADCLICK <
aOnHeadClickProcedure> | <abBlock> ]
[ INPLACE <
EditControls> ]
[ CELLED | CELLNAVIGATION ]
[ COLUMNCONTROLS {
aControlDef1,aControlDef2,...aControlDefN } ]
[ COLUMNVALID <ColumnValid> ]
[ COLUMNWHEN <
ColumnWhen> ]
[ VALIDMESSAGES <a
cValidationMessages> ]
[ VIRTUAL ]
[ ITEMCOUNT <
nItemCount> ]
[ ON QUERYDATA <
OnQueryDataProcedure> | <bBlock> ]
[ MULTISELECT ]
[ NOLINES ]
[ NOHEADERS ]
[ IMAGE <
acImageNames> ]
[ JUSTIFY <
anJustifyValue> ]
[ HELPID <
nHelpId> ]
[ BREAK ]
[ HEADERIMAGE <
aImageHeader> ]
[ NOTABSTOP ]
[ CHECKBOXES ]

Dialog Window:

REDEFINE GRID <ControlName>
ID <
nId>
[ OF | PARENT | DIALOG <
ParentWindowName> ]
[ HEADERS <
acHeaders>]
[ WIDTHS <
anWidths> ]
[ ITEMS <
acItems> ]
[ VALUE <
nValue> ]
[ FONT <
cFontname> SIZE <nFontsize> ]
[ BOLD ] [ ITALIC ] [ UNDERLINE ] [ STRIKEOUT ]
[ TOOLTIP <
cToolTipText> ]
[ BACKCOLOR <
aBackColor> ]
[ FONTCOLOR <
aFontColor> ]
[ DYNAMICBACKCOLOR <
aDynamicBackColor> ]
[ DYNAMICFORECOLOR <
aDynamicForeColor> ]
[ ON GOTFOCUS <
OnGotFocusProcedur> | <bBlock> ]
[ ON CHANGE <
OnChangeProcedure> | <bBlock> ]
[ ON LOSTFOCUS <
OnGotFocusProcedur> | <bBlock> ]
[ [ ON DBLCLICK <
OnDblClickProcedure> | <bBlock> ] | [ EDIT ] ]
[ ON HEADCLICK <
aOnHeadClickProcedure> | <abBlock> ]
[ INPLACE <
EditControls> ]
[ CELLED | CELLNAVIGATION ]
[ COLUMNVALID <
ColumnValid> ]
[ COLUMNCONTROLS {
aControlDef1,aControlDef2,...aControlDefN } ]
[ COLUMNWHEN <
ColumnWhen> ]
[ VALIDMESSAGES <a
cValidationMessages> ]
[ VIRTUAL ]
[ ITEMCOUNT <
nItemCount> ]
[ ON QUERYDATA <
OnQueryDataProcedure> | <bBlock> ]
[ MULTISELECT ]
[ NOLINES ]
[ NOHEADERS ]
[ IMAGE <
acImageNames> ]
[ JUSTIFY <
anJustifyValue> ]
[ HELPID <
nHelpId> ]
[ BREAK ]
[ HEADERIMAGE <
aImageHeader> ]
[ NOTABSTOP ]
[ CHECKBOXES ]

SPLITBOX VERSION

GRID <ControlName>
[ OF | PARENT <
ParentWindowName> ]
[ WIDTH <
nWidth> ]
[ HEIGHT <
nHeight> ]
[ HEADERS <
acHeaders>]
[ WIDTHS <
anWidths> ]
[ ITEMS <
acItems> ]
[ VALUE <
nValue> ]
[ FONT <
cFontname> SIZE <nFontsize> ]
[ BOLD ] [ ITALIC ] [ UNDERLINE ] [ STRIKEOUT ]
[ TOOLTIP <
cToolTipText> ]
[ BACKCOLOR <
aBackColor> ]
[ FONTCOLOR <
aFontColor> ]
[ DYNAMICBACKCOLOR <
aDynamicBackColor> ]
[ DYNAMICFORECOLOR <
aDynamicForeColor> ]
[ ON GOTFOCUS <
OnGotFocusProcedur> | <bBlock> ]
[ ON CHANGE <
OnChangeProcedure> | <bBlock> ]
[ ON LOSTFOCUS <
OnGotFocusProcedur> | <bBlock> ]
[ [ ON DBLCLICK <
OnDblClickProcedure> | <bBlock> ] | [ EDIT ] ]
[ ON HEADCLICK <
aOnHeadClickProcedure> | <abBlock> ]
[ INPLACE <
EditControls> ]
[ CELLED | CELLNAVIGATION ]
[ COLUMNVALID <
ColumnValid> ]
[ COLUMNCONTROLS {
aControlDef1,aControlDef2,...aControlDefN } ]
[ COLUMNWHEN <ColumnWhen> ]
[ VALIDMESSAGES <a
cValidationMessages> ]
[ VIRTUAL ]
[ ITEMCOUNT <
nItemCount> ]
[ ON QUERYDATA <
OnQueryDataProcedure> | <bBlock> ]
[ MULTISELECT ]
[ NOLINES ]
[ NOHEADERS ]
[ IMAGE <
acImageNames> ]
[ JUSTIFY <
anJustifyValue> ]
[ HELPID <
nHelpId> ]
[ BREAK ]
[ HEADERIMAGE <
aImageHeader> ]
[ NOTABSTOP
]
[ CHECKBOXES ]

Alternate Syntax:

DEFINE GRID <ControlName>

[ ID <nId> ]
[ PARENT <
ParentWindowName> ]
COL <
nCol>
ROW <
nRow>
[ WIDTH <
nWidth> ]
[ HEIGHT <
nHeight> ]
[ HEADERS <
acHeaders>]
[ WIDTHS <
anWidths> ]
[ ITEMS <
acItems> ]
[ VALUE <
nValue> ]
[ FONTNAME <
cFontname>
[ FONTSIZE <
nFontsize> ]
[ FONTBOLD < .T. | .F.> ]
[ FONTITALIC < .T. | .F.> ]
[ FONTUNDERLINE < .T. | .F.> ]
[ FONTSTRIKEOUT < .T. | .F.> ]
[ TOOLTIP <
cToolTipText> ]
[ BACKCOLOR <
aBackColor> ]
[ FONTCOLOR <
aFontColor> ]
[ DYNAMICBACKCOLOR <
aDynamicBackColor> ]
[ DYNAMICFORECOLOR <
aDynamicForeColor> ]
[ ONGOTFOCUS <
OnGotFocusProcedur> | <bBlock> ]
[ ONCHANGE
<OnChangeProcedure> | <bBlock> ]
[ ONLOSTFOCUS <
OnGotFocusProcedur> | <bBlock> ]
[ [ ONDBLCLICK <
OnDblClickProcedure> | <bBlock> ] | [ ALLOWEDIT < .T. | .F.> ] ]
[ ONHEADCLICK <
aOnHeadClickProcedure> | <abBlock> ]
[ INPLACEEDIT <
EditControls> ]
[ CELLED | CELLNAVIGATION < .T. | .F.> ]
[ COLUMNCONTROLS {
aControlDef1,aControlDef2,...aControlDefN } ]
[ COLUMNVALID <ColumnValid> ]
[ COLUMNWHEN <
ColumnWhen> ]
[ VALIDMESSAGES <a
cValidationMessages> ]
[ VIRTUAL < .T. | .F.> ]
[ ITEMCOUNT <
nItemCount> ]
[ ON QUERYDATA <
OnQueryDataProcedure> | <bBlock> ]
[ MULTISELECT < .T. | .F.> ]
[ NOLINES < .T. | .F.> ]
[ SHOWHEADERS < .T. | .F.> ]
[ IMAGE <
acImageNames> ]
[ JUSTIFY <
anJustifyValue> ]
[ HELPID <
nHelpId> ]
[ BREAK < .T. | .F.> ]
[ HEADERIMAGE <
aImageHeader> ]
[ NOTABSTOP < .T. | .F.> ]
[ CHECKBOXES < .T. | .F.> ]


END GRID

EDIT INPLACE { aControlDef1 , aControlDef2 , ... , aControlDefN }

Control Definition Array:

TEXTBOX {
cControlType , cDataType , cInputMask , cFormat }

cControlType = 'TEXTBOX' (Required)
cDataType = 'CHARACTER' , 'NUMERIC' , 'DATE' (Required)
cInputMask = cInputMask (Optional)
cFormat = cFormat (Optional)

DATEPICKER {
cControlType , cControlStyle }

cControlType = 'DATEPICKER' (Required)
cControlStyle = 'DROPDOWN' , 'UPDOWN' (Required)

COMBOBOX {
cControlType , acItems }

cControlType 'COMBOBOX' (Required)
acItems (Required)

SPINNER {
cControlType , nRangeMin , nRangeMax }

cControlType 'SPINNER' (Required)
nRangeMin (Required)
nRangeMax (Required)

CHECKBOX {
cControlType , cCheckedLabel , cUnCheckedLabel }

cControlType 'CHECKBOX' (Required)
cCheckedLabel (Required)
cUnCheckedLabel (Required)


DYNAMIC {
cControlType , bCodeBlock }

cControlType = 'DYNAMIC' (Required)
bCodeBlock = CodeBlock that return array with normal type control (Required)
                  to CodeBlock is passed two params - row and column indexes.


Data type for each column will depend control specified.

NUMERIC TEXTBOX : NUMERIC
DATE TEXTBOX : DATE
CHARACTER TEXTBOX : CHARACTER
SPINNER : NUMERIC
COMBOBOX : NUMERIC
CHECKBOX : LOGICAL

Remarks

If MULTISELECT clause is used VALUE must be a numeric array, containing the index position of selected items.

If EDIT clause is used, by doubleclicking an item, will open an editing window allowing to change the item content.

EDIT and MULTISELECT clauses can't be used simultaneously.

The leftmost column in a grid control must be left aligned.

When used in control definition, Header property must be loaded with a character array containing as elements as control columns.

When AddColumn / DeleteColumn methods are used, all items in grid (if any) will be lost.

PROPERTIES:

·   Value
Set / Gets Grid value - selected record number
·   Enabled
Set / Gets enabled state of a Grid control
·   Visible          
Set / Gets visible a Grid control.
·   Row
Set / Gets row position of a Grid control.
·   Col   
Set / Gets column position of a Grid control.
·   Width
Set / Gets width of a Grid control.
·   Height
Set / Gets height of a Grid control.
·   Header (nColumnIndex)
Set / Get header text in a Grid control.
·   HeaderImage(nColumnNumber)
Set / Gets header image in a Grid control.
·   FontName
Set / Gets Grid control's font name.
·   FontSize
Set / Gets Grid control's font size.
·   FontBold
Set / Gets Grid control's font bold property
·   FontItalic
Set / Gets Grid control's font italic property
Set / Gets Grid control's font underline property
Set / Gets Grid control's font strikeout property
·   ToolTip
Set / Gets Grid control's tooltip text.
·   BackColor
Set / Gets the background color for text within the control
·   FontColor
Set / Gets the foreground color for text within the control
·   Cargo
Set / Gets user property 'Cargo' for Grid control
·   Item ( nItemIndex )
Set / Get item text in a Grid control.
·   Cell( nRow , nCol )
Set / Get cell value in Grid control.
·   ItemCount (R)
Get item count in a Grid control.
·   Name (R)
Retrieves the name of a Grid control.
·   Parent (D)
Set the name as character identifier of the parent window.
·   HelpId (D)
Set the numeric help topic identifier of the control.
·   Widths (D)
 
·   Virtual (D)
 
·   ValidMessages (D)
 
·   MultiSelect (D)
 
·   NoLines (D)
 
·   Image (D)
 
·   Justify (D)
 
·   AllowEdit (D)
 
·   ColumnControls (D)
 
·   ColumnValid (D)
 
·   ColumnWhen (D)
 
·   ShowHeaders (D)
Sets a value that indicates whether the header is displayed in the Grid control.
·   DynamicBackColor (D)
 
·   DynamicForeColor (D)
 
·   Break (D)
Control passes to the statement that follows the terminated statement.
·   NoTabStop (D)
Sets whether an element behavior can't receive focus and participate in the tabbing sequence

D: Available at control definition only
R: Read-Only

Properties Available For OnQueryData Procedure

·     This.QueryData
·     This.QueryRowIndex
·     This.QueryColIndex

Properties Available For OnDblClick Procedure

This.CellRowIndex
This.CellColIndex
This.CellRow
This.CellCol
This.CellWidth
This.CellHeight
This.CellValue

EVENTS:

·   OnGotFocus
An action to be performed when getting the focus
·   OnChange
An action to be performed when generic changing of the control
An action to be performed when losing the focus.
·   OnDblClick
An action to be performed when Double Left clicking.
A list of actions to be executed when a certain column header is clicked with the mouse
·   OnQueryData
 

METHODS:

·   Show
Shows a gui object
·   Hide
Hides a gui object
·   SetFocus
Gives the focus to a control.
·   Release
Releases a control from memory
·   AddItem ( acItemText )
Add a new item to a Grid control.
·   DeleteItem( nItemIndex )
Deletes an item from a Grid.control
Deletes all items from a Grid.control
·   AddColumn ( [ nColIndex ] , [ cCaption ] , [ nWidth ] , [ nJustify ] )
Add a new column to a Grid control.
·   DeleteColumn ( nColIndex )
Deletes a column from a Grid control.
·   ColumnAutoFit (nColumn)
Set widths of a column to fit column contents text & column contents.
·   ColumnAutoFitH (nColumn)
Set widths of a column to fit column header text & column contents
Set widths of all columns to fit each column contents  text & column contents.
Set widths of all columns to fit each column header text & column contents.
Update enables for Grid control
Update disables for Grid control
·   SaveAs
Save Control as BitMap file.

EXAMPLE:

See demos in :
\Samples\Basic\Grid
\Samples\Basic\Grid_1
\Samples\Basic\Grid_2
\Samples\Basic\Grid_3
\Samples\Basic\Grid_4
\Samples\Basic\Grid_5
\Samples\Basic\Grid_6
\Samples\Basic\Grid_7
\Samples\Basic\Grid_8
\Samples\Basic\Grid_9
\Samples\Basic\MAINDEMO_(SYNTAX_I) to _(SYNTAX_IV)