@...GRID DEFINE GRID Creates a Grid control.
|
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 <anBackColor> ]
[ FONTCOLOR <anFontColor> ]
[ DYNAMICBACKCOLOR <anDynamicBackColor> ]
[ DYNAMICFORECOLOR <anDynamicForeColor> ]
[ ON GOTFOCUS <OnGotFocusProcedure> | <bBlock> ]
[ ON CHANGE <OnChangeProcedure> | <bBlock> ]
[ ON LOSTFOCUS <OnLostFocusProcedure> | <bBlock> ]
[ [ ON DBLCLICK <OnDblClickProcedure> | <bBlock> ] | [ EDIT ] ]
[ ON HEADCLICK <aOnHeadClickProcedure> | <abBlock> ]
[ ON CHECKBOXCLICKED CheckBoxesRefresh() ]
[ INPLACE <EditControls> ]
[ CELLED | CELLNAVIGATION ]
[ COLUMNCONTROLS { aControlDef1, aControlDef2,...aControlDefN } ]
[ COLUMNVALID <ColumnValid> ]
[ COLUMNWHEN <ColumnWhen> ]
[ COLUMNWIDTHLIMITS <aWidthLimits ]
[ VALIDMESSAGES <acValidationMessages> ]
[ VIRTUAL ]
[ ITEMCOUNT <nItemCount> ]
[ ON QUERYDATA <OnQueryDataProcedure> | <bBlock> ]
[ MULTISELECT ]
[ NOLINES ]
[ NOHEADERS ]
[ NOSORTHEADERS]
[ IMAGE <acImageNames> ]
[ JUSTIFY <anJustifyValue> ]
[ HELPID <nHelpId> ]
[ BREAK ]
[ COLUMNSORT <columnsort> ]
[ HEADERIMAGE <aImageHeader> ]
[ NOTABSTOP ]
[ CHECKBOXES ]
[ LOCKCOLUMNS <LockColumns> ]
[ PAINTDOUBLEBUFFER> ]
[ ON INIT <bInit> ]
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 <anBackColor> ]
[ FONTCOLOR <anFontColor> ]
[ DYNAMICBACKCOLOR <anDynamicBackColor> ]
[ DYNAMICFORECOLOR <anDynamicForeColor> ]
[ ON GOTFOCUS <OnGotFocusProcedure> | <bBlock> ]
[ ON CHANGE <OnChangeProcedure> | <bBlock> ]
[ ON LOSTFOCUS <OnLostFocusProcedure> | <bBlock> ]
[ [ ON DBLCLICK <OnDblClickProcedure> | <bBlock> ] | [ EDIT ] ]
[ ON HEADCLICK <aOnHeadClickProcedure> | <abBlock> ]
[ ON CHECKBOXCLICKED CheckBoxesRefresh() ]
[ INPLACE <EditControls> ]
[ CELLED | CELLNAVIGATION ]
[ COLUMNVALID <ColumnValid> ]
[ COLUMNCONTROLS { aControlDef1, aControlDef2,...aControlDefN } ]
[ COLUMNWHEN <ColumnWhen> ]
[ COLUMNWIDTHLIMITS <aWidthLimits ]
[ VALIDMESSAGES <acValidationMessages> ]
[ VIRTUAL ]
[ ITEMCOUNT <nItemCount> ]
[ ON QUERYDATA <OnQueryDataProcedure> | <bBlock> ]
[ MULTISELECT ]
[ NOLINES ]
[ NOHEADERS ]
[ NOSORTHEADERS ]
[ IMAGE <acImageNames> ]
[ JUSTIFY <anJustifyValue> ]
[ HELPID <nHelpId> ]
[ BREAK ]
[ COLUMNSORT <columnsort> ]
[ HEADERIMAGE <aImageHeader> ]
[ NOTABSTOP ]
[ CHECKBOXES ]
[ LOCKCOLUMNS <LockColumns> ]
[ PAINTDOUBLEBUFFER> ]
[ ON INIT <bInit> ]
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 <anBackColor> ]
[ FONTCOLOR <anFontColor> ]
[ DYNAMICBACKCOLOR <aDynamicBackColor> ]
[ DYNAMICFORECOLOR <aDynamicForeColor> ]
[ ON GOTFOCUS <OnGotFocusProcedure> | <bBlock> ]
[ ON CHANGE <OnChangeProcedure> | <bBlock> ]
[ ON LOSTFOCUS <OnLostFocusProcedure> | <bBlock> ]
[ [ ON DBLCLICK <OnDblClickProcedure> | <bBlock> ] | [ EDIT ] ]
[ ON HEADCLICK <aOnHeadClickProcedure> | <abBlock> ]
[ ON CHECKBOXCLICKED CheckBoxesRefresh() ]
[ INPLACE <EditControls> ]
[ CELLED | CELLNAVIGATION ]
[ COLUMNVALID <ColumnValid> ]
[ COLUMNCONTROLS { aControlDef1, aControlDef2,...aControlDefN } ]
[ COLUMNWHEN <ColumnWhen> ]
[ COLUMNWIDTHLIMITS <aWidthLimits ]
[ VALIDMESSAGES <acValidationMessages> ]
[ VIRTUAL ]
[ ITEMCOUNT <nItemCount> ]
[ ON QUERYDATA <OnQueryDataProcedure> | <bBlock> ]
[ MULTISELECT ]
[ NOLINES ]
[ NOHEADERS ]
[ NOSORTHEADERS ]
[ IMAGE <acImageNames> ]
[ JUSTIFY <anJustifyValue> ]
[ HELPID <nHelpId> ]
[ BREAK ]
[ COLUMNSORT <columnsort> ]
[ HEADERIMAGE <aImageHeader> ]
[ NOTABSTOP ]
[ CHECKBOXES ]
[ LOCKCOLUMNS <LockColumns> ]
[ PAINTDOUBLEBUFFER> ]
[ ON INIT <bInit> ]
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 <anBackColor> ]
[ FONTCOLOR <anFontColor> ]
[ DYNAMICBACKCOLOR <anDynamicBackColor> ]
[ DYNAMICFORECOLOR <anDynamicForeColor> ]
[ ONGOTFOCUS <OnGotFocusProcedure> | <bBlock> ]
[ ONCHANGE <OnChangeProcedure> | <bBlock> ]
[ ONLOSTFOCUS <OnLostFocusProcedure> | <bBlock> ]
[ [ ONDBLCLICK <OnDblClickProcedure> | <bBlock> ]
| [ ALLOWEDIT < .T. | .F.> ] ]
[ ONHEADCLICK <aOnHeadClickProcedure> | <abBlock> ]
[ ONCHECKBOXCLICKED CheckBoxesRefresh() ]
[ INPLACEEDIT <EditControls> ]
[ CELLED | CELLNAVIGATION < .T. | .F.> ]
[ COLUMNCONTROLS { aControlDef1, aControlDef2,...aControlDefN } ]
[ COLUMNVALID <ColumnValid> ]
[ COLUMNWHEN <ColumnWhen> ]
[ COLUMNWIDTHLIMITS <aWidthLimits ]
[ VALIDMESSAGES <acValidationMessages> ]
[ VIRTUAL < .T. | .F.> ]
[ ITEMCOUNT <nItemCount> ]
[ ON QUERYDATA <OnQueryDataProcedure> | <bBlock> ]
[ MULTISELECT < .T. | .F.> ]
[ NOLINES < .T. | .F.> ]
[ SHOWHEADERS < .T. | .F.> ]
[ NOSORTHEADERS < .T. | .F.> ]
[ IMAGE <acImageNames> ]
[ JUSTIFY <anJustifyValue> ]
[ HELPID <nHelpId> ]
[ BREAK < .T. | .F.> ]
[ COLUMNSORT <columnsort> ]
[ HEADERIMAGE <aImageHeader> ]
[ NOTABSTOP < .T. | .F.> ]
[ CHECKBOXES < .T. | .F.> ]
[ LOCKCOLUMNS <LockColumns> ]
[ PAINTDOUBLEBUFFER < .T. | .F.> ]
[ ONINIT <bInit> ]
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.
If COLUMNSORT <aSort> clause is used, the array aSort may have the following
values for each column:
0 - no sorting;
1 - ascending sort;
2 - descending sort.
nRow, nCol
|
Position in the area of ??the window in pixels.
|
nWidth, nHeight
|
The desired size of the Grid Control in pixels.
|
nId
|
The ID identifier this Control in Dialog Window
|
ControlName
|
A reference to the Grid Control
|
ParentWindowName
|
A reference to the Parent Window.
|
nHelpID
|
The help topic identifier for this Control
|
acHeaders
|
A list of text expressions for headers of each column
|
anWidths
|
A list of sizes for each column in pixels
|
acItems
|
A list of data ie: Array( nRow, nColumn )
|
nValue
|
|
cFontName, nFontSize
|
A reference to the Font and size the Font.
|
cToolTipText
|
Specifies the text for the ToolTip
|
anBackColor
|
A list of Background color for text
|
anFontColor
|
A list of Foreground color for text
|
anDynamicBackColor
|
A list of codeblock returning a Background RGB array for each
column
|
anDynamicForeColor
|
A list of codeblock returning a Foreground RGB array for each column
|
OnGotFocusProcedure
|
An action to be performed when Grid is focused.
|
OnChangeProcedure
|
An action to be performed when selecting a new row.
|
OnLostFocusProcedure
|
An action to be performed when Browse lost focused.
|
OnDblClickProcedure
|
An action to be performed when DblClick a Browse row.
|
aOnHeadClickProcedure
|
A list of actions to be executed when a certain column header is
clicked with the mouse.
|
CheckBoxesRefresh
|
?
|
{aControlDef1, aControlDef2,...
aControlDefN }
|
?
|
ColumnValid
|
A list of Valid codeblock for each column
|
ColumnWhen
|
A list of When codeblock for each column
|
acValidationMessages
|
A list of associated messages of fields displayed when editable Field
loses its focus and is not valid.
|
nItemCount
|
Specifies the number of items in the Grid
|
OnQueryDataProcedure
|
?
|
acImageNames
|
A list of Image for the 1st Column using an IndexValue
|
anJustifyValue
|
A list of Justification value for each column (see Justify table below)
|
aHeaderImage
|
A list of Image for the header of each column
|
|
|
CELLED | CELLNAVIGATION
|
Specifies that we want to move in the grid in a Cell by Cell mode
(Similar to an excel speadsheet)
|
VIRTUAL
|
Specifies that we are using Virtual Grid
|
MULTISELECT
|
Specifies that we can select multiple items in the Grid
|
NOLINES
|
Specifies that we do not want lines between Grid Rows
|
NOHEADERS
|
Specifies that we do not want to show column headers
|
NOSORTHEADERS
|
Specifies that we do not want to SORT headers
|
BREAK
|
?
|
NOTABSTOP
|
Stop the control to receive focus and participate in the tabbing
sequence
|
CHECKBOXES
|
Specifies that we want to add a CheckBox as the first column of the
Grid
|
LOCKCOLUMNS
|
Specifies to lock (Freeze) column(s) in the grid they will stay visible
when scrolling the grid
|
PAINTDOUBLEBUFFER
|
?
|
REMARKS:
· acImageNames is an array of image to use in the first column of a grid refer to an image by it's Index Position see demo \Samples\Basic\Grid_6
ie : IMAGE { "GreenDot.bmp", "YellowDot.bmp", "RedDot.bmp" }
ITEMS { { 1, "Green dot" }, { 2, "Yellow dot" }, { 3, "Red dot" }, { 2, "Yellow dot" } }
JUSTIFY TABLE: (see \include\i_grid.ch)
#DEFINE Value
|
Value (Numeric)
|
|
|
GRID_JTFY_LEFT
|
0
|
GRID_JTFY_RIGHT
|
1
|
GRID_JTFY_CENTER
|
2
|
GRID_JTFY_JUSTIFYMASK
|
3
|
PROPERTIES:
Set / Gets Grid value - selected record number
| |
Set / Gets enabled state of a Grid control
| |
Set / Gets visible a Grid control.
| |
Set / Gets row position of a Grid control.
| |
Set / Gets column position of a Grid control.
| |
Set / Gets width of a Grid control.
| |
Set / Gets height of a Grid control.
| |
Set / Get header text in a Grid control.
| |
Set / Gets header image in a Grid control.
| |
Set / Gets column display position in a browse control
| |
Set / Gets Grid control's font name.
| |
Set / Gets Grid control's font size.
| |
Set / Gets Grid control's font bold property
| |
Set / Gets Grid control's font italic property
| |
Set / Gets Grid control's font underline property
| |
Set / Gets Grid control's font strikeout property
| |
Set / Gets Grid control's tooltip text.
| |
Set / Gets the background color for text within the control
| |
Set / Gets the foreground color for text within the control
| |
Set / Gets user property 'Cargo' for Grid control
| |
Set / Get item text in a Grid control.
| |
Set / Get cell value in Grid control.
| |
Get item count in a Grid control.
| |
Get item count in a Grid control.
| |
Retrieves the name of a Grid control.
| |
Set the name as character identifier of the parent window.
| |
Set the numeric help topic identifier of the control.
| |
Set an array containing the sizes for each column of the Grid
| |
· SetHeaderImages
|
Set of Header Images array to Grid control
|
Specifies whether a Grid control allow virtual rows
| |
Character array (one element per column) with messages to show
when valid procedure returns .F.
| |
Specifies whether multiple selection is allowed in Grid controls
| |
Specifies whether lines are shown in a Grid control
| |
Specifies a character array containing image filenames or
resource names to be used with Grid control
| |
Numeric array (one element for each column) containing
justification constants for Grid controls
| |
Specifies whether records can be edited from a table within a Grid
control (Available at control definition)
| |
Specifies controls to be used for each column in a Grid Control
| |
Codeblock array (one element per column) that is evaluated after
field editing for Grid control
| |
Codeblock array (one element per column) that is evaluated prior
to field editing for Grid control
| |
Numeric array ( { nMinWidth, nMaxWidth } or NIL.)
for an each
column
| |
Sets a value that indicates whether the header is displayed in the
Grid control.
| |
Dynamically Set The Background Color for
a Grid Cell
| |
Dynamically Set The Foreground Color for
a Grid Cell
| |
Dynamically Set The Background Color for
a Grid Header
| |
Dynamically Set The Foreground Color for a Grid Header
| |
Dynamically Set The Font a Grid Header
| |
Control passes to the statement that follows the terminated
statement.
| |
Sets whether an element behavior can't receive focus and
participate in the tabbing sequence
| |
Set / Get a justify index in a Grid control.
| |
Set / Get a control in a Grid control.
| |
Set / Get a valid in a Grid control.
| |
Set / Get a when in a Grid control.
| |
·
ColumnValidmessage(nColIndex)
|
Set / Get a Validmessage in a Grid control
|
D: Available
at control definition only
R: Read-Only
Properties Available For OnQueryData Procedure
Properties Available For OnDblClick Procedure
EVENTS:
Action to be performed when getting the focus
| |
Action to be performed when generic changing of the control
| |
Action to be performed when losing the focus.
| |
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
|
Occurs when a virtual Grid control requires data to display a cell
|
METHODS:
· Show
|
Shows a GUI object
|
Hides a GUI object
| |
Gives the focus to a control.
| |
Redraw a Control
| |
Releases a control from memory
| |
Add a new item to a Grid control.
| |
Deletes an item from a Grid.control
| |
Deletes all items from a Grid.control
| |
Add a new column to a Grid control.
| |
Deletes a column from a Grid control.
| |
Set widths of a column to fit column contents text & column contents.
| |
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
| |
Save Control as BitMap file.
| |
Set array to the Grid control
| |
Get array to the Grid control
|
EXAMPLE: