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

 

 

 

Standard Syntax (xBase Style):

 

 

      @ <nRow> ,<nCol>

            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 <aDynamicBackColor> ]

            [ ON GOTFOCUS <OnGotFocusProcedur> | <bBlock> ]

            [ ON CHANGE <OnChangeProcedure> | <bBlock> ] 

            [ ON LOSTFOCUS <OnGotFocusProcedur> | <bBlock> ]

            [ [ ON DBLCLICK <OnDblClickProcedure> | <bBlock> ]  |

            [ EDIT | ALLOWEDIT ] ]

            [ COLUMNCONTROLS {aControlDef1,aControlDef2,...aControlDefN}

            [ COLUMNVALID {bValid1,bValid2,...bValidN}

            [ COLUMNWHEN {bWhen1,bWhen2,...bWhenN}

            [ ON HEADCLICK <abBlock> ]

            [ VIRTUAL ]

            [ ITEMCOUNT <nItemCount> ]

            [ ON QUERYDATA <OnQueryDataProcedure> | <bBlock> ]

            [ MULTISELECT ] 

            [ NOLINES ] 

            [ NOHEADERS ]

            [ IMAGE <acImageNames> ] 

            [ JUSTIFY <anJustifyValue> ]

            [ HELPID <nHelpId> ]

            [ BREAK ]

            [ HEADERIMAGES <acHeaderImages> ]

            [ CELLNAVIGATION ]

 

 

Alternate Syntax: 

 

 

      DEFINE GRID <ControlName>

            PARENT <ParentWindowName>

            ROW <nValue> 

            COL <nValue>

            WIDTH <nValue>

            HEIGHT <nValue>

            FONTNAME <cValue>

            FONTSIZE <nValue>

            FONTBOLD <lValue>

            FONTITALIC <lValue>

            FONTUNDERLINE <lValue>

            FONTSTRIKEOUT <lValue>

            TOOLTIP <cValue>

            ONGOTFOCUS <ActionProcedure>

            ONLOSTFOCUS <ActionProcedure>

            ONCHANGE <ActionProcedure>

            TABSTOP <lValue>

            HELPID <nValue>

            VISIBLE <lValue>

            ITEMS <caItems>

            HEADERS <acHeaders>

            WIDTHS <anWidths>

            VALUE <nValue>

            BACKCOLOR <aBackColor>

            FONTCOLOR <aFontColor>

            DYNAMICBACKCOLOR <aDynamicBackColor>

            DYNAMICFORECOLOR <aDynamicBackColor>

            ONDBLCLICK <OnDblClickProcedure>

            ALLOWEDIT <lValue>

            COLUMNCONTROLS {aControlDef1,aControlDef2,...aControlDefN}

            COLUMNVALID {bValid1,bValid2,...bValidN}

            COLUMNWHEN {bWhen1,bWhen2,...bWhenN}

            ONHEADCLICK <abBlock>

            VIRTUAL <lValue>

            ITEMCOUNT <nItemCount>

            ONQUERYDATA <OnQueryDataProcedure>

            MULTISELECT <lValue>

            LINES <lValue>

            HEADERS

            IMAGE <acImageNames> 

            JUSTIFY <anJustifyValue>

            HEADERIMAGES <acHeaderImages>

            CELLNAVIGATION <lValue>

      END GRID

 

 

Properties:

 

 

      - ColumnWhen

      - DynamicBackColor

      - DynamicForeColor

      - Cell ( nRow , nCol )

      - Value

      - Enabled

      - Visible

      - Item ( nItemIndex )

      - ItemCount

      - Row

      - Col

      - Width

      - Height

      - FontName

      - FontSize

      - FontBold

      - FontItalic

      - FontUnderline

      - FontStrikeout

      - ToolTip

      - BackColor

      - FontColor

      - Header (nColumnNumber)

      - HeaderImages (nColumnNumber)

      - Name (R)

      - Virtual (D)

      - Parent (D)

      - Widths (D)

      - MultiSelect (D)

      - NoLines (D)

      - Image (D)

      - Justify (D)

      - HelpId (D)

      - Break (D)

      - AllowEdit (D)

      - ColumnControls (D)

      - ColumnValid (D)

      - Headers (D)

      - CellNavigation (D)

      - Items (D)

      - Image (D)

      - Items (D)

 

 

      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

 

      - Note: These properties are not available when OnDblClick procedure

      is fired by <Enter> key pressing.

 

 

Properties Available For DynamicBackColor / DynamicForeColor / ColumnValid Processing:

 

 

      - This.CellRowIndex

      - This.CellColIndex

      - This.CellValue

 

 

Events:

 

 

      - OnGotFocus

      - OnChange

      - OnLostFocus

      - OnDblClick

      - OnHeadClick

      - OnQueryData

 

 

Methods:

 

 

      - Show

      - Hide

      - AddItem ( acItemText )

      - DeleteItem ( nItemIndex )

      - DeleteAllItems 

      - SetFocus

      - Release

      - AddColumn ( [ nColIndex ] , [ cCaption ] , [ nWidth ] , [ nJustify ] )

      - DeleteColumn ( nColIndex )

 

- Hints:

 

- 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 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.

 

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)

 

      Data type for each column will depend control specified.

 

            NUMERIC TEXTBOX         : NUMERIC

            DATE TEXTBOX            : DATE           

            CHARACTER TEXTBOX : CHARACTER

            SPINNER                 : NUMERIC

            COMBOBOX          : NUMERIC

            CHECKBOX          : LOGICAL

 

      Sample:

 

      @ 10,10 GRID Grid_1 ;

            WIDTH 620 ;

            HEIGHT 330 ;

            HEADERS {'Column 1','Column 2','Column 3','Column 4',;

                  'Column 5'} ;

            WIDTHS {140,140,140,140,140} ;

            ITEMS aRows ;

            EDIT ;

            COLUMNCONTROLS { {'TEXTBOX','NUMERIC','$ 999,999.99'},;

                  {'DATEPICKER','DROPDOWN'} ,;

                  {'COMBOBOX',{'One','Two','Three'}} , ;

                  { 'SPINNER' , 1 , 20 } , ;

                  { 'CHECKBOX' , 'Yes' , 'No' } }

 

 

Justify constants:

 

 

      - GRID_JTFY_LEFT            

      - GRID_JTFY_RIGHT           

      - GRID_JTFY_CENTER