Data Grid

Typeobject
DictionaryDataGrid
LibraryData Grid
Associationsdatagrid
Summary

An object for forms or tables

Description

The Data Grid enables you to integrate powerful tables and forms into your LiveCode projects. Data grids combine LiveCode groups and behaviors to provide you with a simple, yet flexible means of displaying your data in just about any way you want. See the datagrid lessson for full documentation, lessons, and tutorials.

TypeNameSummarySyntax
commandAddData

Use this command to add data to the data grid after you have already populated it by setting the dgData or dgText.

dispatch "AddData" to group "DataGrid" with pDataArray,pLine

- - -AddLine

Add tab delimited text to the data grid after you have already populated it by setting the dgData or dgText.

dispatch "AddLine" to group "DataGrid" with pText, pColumns,

pLine

- - -DeleteIndex

Deletes the specified indexes from the data grid.

dispatch "DeleteIndex" to group "DataGrid" with pIndex

- - -DeleteIndexes

Deletes the specified indexes from the data grid.

dispatch "DeleteIndexes" to group "DataGrid" with pIndexes

- - -DeleteLine

Deletes the specified lines from the data grid.

dispatch "DeleteLine" to group "DataGrid" with pLine

- - -DeleteLines

Deletes the specified lines from the data grid.

dispatch "DeleteLine" to group "DataGrid" with pLines

- - -EditCell

Sends the EditValue message to the column control for column pColumnName of line pLineNo.

dispatch "EditCell" to group "DataGrid" with pColumnName,

pLineNo

- - -EditCellOfIndex

Same as EditCell but uses an index rather than a line number to locate the line to edit.

dispatch "EditCellOfIndex" to group "DataGrid" with pColumnName,

pIndex

- - -EditFieldText

Creates an editable field for editing the contents of pField.

dispatch "EditFieldText" to group "DataGrid" with pField,

pIndex, pKey

- - -EditKey

Sends the EditValue pKey message to the row control for line pLineNo.

dispatch "EditKey" to group "DataGrid" with pKey, pLineNo

- - -EditKeyOfIndex

Same as EditKey but uses an index rather than a line number to located the line to edit.

dispatch "EditKeyOfIndex" to group "DataGrid" with pKey, pIndex

- - -EditModeHideActionControl

Hide any visible data grid action control.

dispatch "EditModeHideActionControl" to group "DataGrid" with {true | false}

- - -EditModeShowActionControlForIndex

Display the action control for the data grid row with the given index.

dispatch "EditModeShowActionControlForIndex" to group "DataGrid" with

<row index>

- - -FindIndex

Same as EditKey but uses an index rather than a line number to located the line to edit.

dispatch "FindIndex" to group "DataGrid" with pKey,

pSearchString

- - -RefreshIndex

Redraws row associated with pIndexes using latest data.

dispatch "RefreshIndex" to group "DataGrid" with pIndexes

- - -RefreshLine

Redraws row using latest data.

dispatch "RefreshLine" to group "DataGrid" with pLines

- - -RefreshList

Redraws the data displayed in the data grid.

dispatch "RefreshList" to group "DataGrid"

- - -ResetControl

Resets the control by clearing out any data.

dispatch "ResetControl" to group "DataGrid"

- - -ResetList

Redraws the data grid data after having copied in fresh copies of any templates.

dispatch "ResetList" to group "DataGrid"

- - -ResizeToFit

Used internally when the rect of the data grid changes.

dispatch "ResizeToFit" to group "DataGrid"

- - -RowSwipeHideControl

Hide any visible data grid swipe control.

dispatch "RowSwipeHideControl" to group "DataGrid" with {true | false}

- - -RowSwipeShowControlForIndexAndSide

Display the data grid swipe control on the given side of the row with the given index.

dispatch "RowSwipeShowControlForIndexAndSide" to group "DataGrid" with

<row index>, {"left" | "right"}

- - -ScrollIndexIntoView

Scrolls the data grid so that the line associated with pIndex in the internal data array is in view.

dispatch "ScrollIndexIntoView" to group "DataGrid" with pIndex

- - -ScrollLineIntoView

Scrolls the data grid so that pLine is in view.

dispatch "ScrollLineIntoView" to group "DataGrid" with pLine

- - -SelectAll

Selects all lines in the data grid.

dispatch "SelectAll" to group "DataGrid"

- - -SetDataOfIndex

Updates the key pIndex in the internal data array.

dispatch "SetDataOfIndex" to group "DataGrid" with pIndex, pKey,

pValue

- - -SetDataOfLine

Updates the internal array of line pLine in the data grid.

dispatch "SetDataOfLine" to group "DataGrid" with pLine, pKey,

pValue

- - -SortByColumn

Pass in a column to sort by.

dispatch "SortByColumn" to group "DataGrid" with pColumn

- - -SortDataByKey

SortDataByKey is the underlying command that all column sorts call.

dispatch "SortDataByKey" to group "DataGrid" with pArrayKey,

pSortType, pDirection, pCaseSensitive

functionColumnControlOfIndex

Returns the control for the column of index pIndex in the Data Grid.

put ColumnControlOfIndex(pColumnName, pIndex)

- - -GetDataOfIndex

Retrieves the internal array for key pIndex of the internal array in the data grid.

put GetDataOfIndex(pIndex, pKey)

- - -GetDataOfLine

Retrieves the internal array associated with line pLine in the data grid.

put GetDataOfLine(pLine, pKey)

glossaryDatagrid Column Properties

These properties allow you to set properties of individual columns in a table when the 'style' property is set to 'table'.

Datagrid Column Properties

- - -Datagrid Commands

Datagrid commands are issued via 'dispatch' or 'send'.

Datagrid Commands

- - -Datagrid General Properties

General properties of the datagrid are applicable whether the 'style' property is set to 'form' or 'table'

Datagrid General Properties

- - -Datagrid Table Properties

Table properties of the datagrid are applicable when the 'style' property is set to 'table'.

Datagrid Table Properties

- - -Datagrid Template Custom Properties & Messages

The properties and messages associated with the Data Grid template

Datagrid Template Custom Properties & Messages

- - -Template Field Editor Properties

Datagrid cells can be edited. These property configure that editor.

Template Field Editor Properties

messageEditModeActionControlClicked

Sent when a user clicks on a data grid edit mode action control.

on EditModeActionControlClicked pTarget

- - -EditModeActionControlHidden

Sent when the datagrid's edit mode action control is hidden.

on EditModeActionControlHidden

- - -EditModeActionSelectControlClicked

Sent when a user clicks on a data grid edit mode action select control.

on EditModeActionSelectControlClicked pTarget

- - -EditModeReorderCompleted

Sent when a user completes a dynamic reordering of a data grid.

EditModeReorderCompleted pIndex, pStartLineNo, pNewLineNo

- - -EditModeReorderStarted

Sent when a user starts a dynamic reordering of a data grid.

EditModeReorderStarted pIndex, pLineNo

- - -EditValue

The EditValue message is sent to a table column control when EditCell or EditCellOfIndex is called.

on EditValue pKey

- - -FillInData

The EditValue message is sent to a table column control when EditCell or EditCellOfIndex is called.

on FillInData pData

- - -GetEditModeActionControl

Handle this message to specify a custom data grid action control.

on GetEditModeActionControl

- - -GetEditModeActionSelectControl

Handle this message to specify a custom data grid action select control.

on GetEditModeActionSelectControl

- - -GetEditModeReorderControl

Handle this message to specify a custom data grid action select control.

on GetEditModeReorderControl

- - -GetLeftSwipeControl

Handle this message to specify a custom data grid left hand side swipe control.

on GetLeftSwipeControl

- - -GetRightSwipeControl

Handle this message to specify a custom data grid right hand side swipe control.

on GetRightSwipeControl

- - -LayoutControl

The EditValue message is sent to a table column control when EditCell or EditCellOfIndex is called.

on LayoutControl pControlRect, pWorkingRect

- - -RowLeftSwipeControlClicked

Sent when the left hand side data grid swipe control is clicked.

on RowLeftSwipeControlClicked pTarget

- - -RowLeftSwipeControlHidden

Sent when the left hand side data grid swipe control is hidden.

on RowLeftSwipeControlHidden

- - -RowRightSwipeControlClicked

Sent when the right hand side data grid swipe control is clicked.

on RowRightSwipeControlClicked pTarget

- - -RowRightSwipeControlHidden

Sent when the right hand side data grid swipe control is hidden.

on RowRightSwipeControlHidden

- - -RowSwipedLeft

Sent when the user swipes a data grid row left.

on RowSwipedLeft

- - -RowSwipedRight

Sent when the user swipes a data grid row right.

on RowSwipedRight

- - -selectionChanged

Sent whenever the user changes the selection through some sort of user interaction.

on selectionChanged pHilitedIndexes, pPreviouslyHilitedIndexes

objectData Grid

An object for forms or tables

on selectionChanged pHilitedIndexes, pPreviouslyHilitedIndexes

propertyallow column resizing

If true then the user can resize columns in the table header.

put the dgProp["allow column resizing"] of group "Data Grid"

- - -allow editing

Set to true to allow users to edit the cells of a table or the fields in a form.

set the dgProp["allow editing"] of group "Data Grid"

- - -alternate row color

The color of every other row's background.

put the dgProp["alternate row color"] of group "Data Grid"

- - -alternate row colors

Set to true to alternate the background colors of every other row.

put the dgProp["alternate row colors"] of group "Data Grid"

- - -animate actions

Turn animations on or off for the data grid.

set the dgProp["animate actions"] of group "Data Grid" to {true | false}

- - -auto hilite

Enables the data grid to automatically handle row highlighting.

put the dgProp["auto hilite"] of group "Data Grid"

- - -background color

The background color of the data grid.

put the dgProp["background color"] of group "Data Grid"

- - -cache controls

Caches all controls for rendering.

put the dgProp["cache controls"] of group "Data Grid"

- - -column alignments

Allows you to set all column alignment values at once.

put the dgProp["column alignments"] of group "Data Grid"

- - -column divider color

The color of the column dividers in a table.

put the dgProp["column divider color"] of group "Data Grid"

- - -column labels

Line delimited list of labels for columns in your table.

put the dgProp["column labels"] of group "Data Grid"

- - -column margins

Specifies the margins to be applied to each cell in a column.

put the dgProp["column margins"] of group "Data Grid"

- - -column visibility

Allows you to set the visible property for all columns at once.

put the dgProp["column visibility"] of group "Data Grid"

- - -column widths

Allows you to set all column widths at once. Comma delimited list of integers.

put the dgProp["column widths"] of group "Data Grid"

- - -columns

Line delimited list of columns in your table.

put the dgProp["columns"] of group "Data Grid"

- - -control type

Returns "data grid"

put the dgProp["control type"] of group "Data Grid"

- - -corner color

The color of the corner piece that appears when both horizontal and vertical scrollbars are visible.

put the dgProp["corner color"] of group "Data Grid"

- - -default column behavior

Used to set the default column behavior.

put the dgProp["default column behavior"] of group "Data Grid"

- - -default header behavior

Used to set the default header behavior.

put the dgProp["default header behavior"] of group "Data Grid"

- - -dgColumn

Get the name of the column the instance of the template is Associations with.

get the dgColumn of me

- - -dgColumnAlignment

Get/set the alignment for a column.

put the dgColumnAlignment["col1"] of group "Data Grid"

- - -dgColumnIsEditable

Toggle whether or not a column is editable by the user.

put the dgColumnIsEditable["col1"] of group "Data Grid"

- - -dgColumnIsResizable

Get/set whether or not a column is resizable.

put the dgColumnIsResizable["col1"] of group "Data Grid"

- - -dgColumnIsVisible

Get/set the visibility of the column.

put the dgColumnIsVisible["col1"] of group "Data Grid"

- - -dgColumnLabel

Get/set the label used for the column.

put the dgColumnLabel["col1"] of group "Data Grid"

- - -dgColumnMaxWidth

Get/Set the maximum width that a column can be resized to.

put the dgColumnMaxWidth["col1"] of group "Data Grid"

- - -dgColumnMinWidth

Get/Set the minimum width that a column can be resized to.

put the dgColumnMinWidth["col1"] of group "Data Grid"

- - -dgColumnName

Set a new name for a column.

set the dgColumnName["col1"] of group "Data Grid" to pNewName

- - -dgColumnNumber

Get the column number relative to all visible columns.

get the dgColumnNumber of me

- - -dgColumnSortDirection

Get/set the direction of the sort for the column.

put the dgColumnSortDirection["col1"] of group "Data Grid"

- - -dgColumnSortIsCaseSensitive

Get/set whether or not column sort is case sensitive.

put the dgColumnSortIsCaseSensitive["col1"] of group "Data Grid"

- - -dgColumnSortType

Get/set the sort type of the column.

put the dgColumnSortType["col1"] of group "Data Grid"

- - -dgColumnTemplate

Get the control that is used to visually represent the column in the table.

put the dgColumnTemplate["col1"] of group "Data Grid"

- - -dgColumnTooltip

Set the tooltip that appears when the mouse is over the column header.

put the dgColumnTooltip["col1"] of group "Data Grid"

- - -dgColumnWidth

Get/set the width of a column.

put the dgColumnWidth["col1"] of group "Data Grid"

- - -dgControl

Returns the long id of the data grid.

get the dgControl of the target

- - -dgData

Get or set the data array that the data grid will display.

set the dgData of group "DataGrid" to <pDataArray>

- - -dgDataControl

This is a custom property defined in the behavior script for your template

getProp dgDataControl

- - -dgDataControlOfIndex

Returns the long id of the data control associated with an index.

get the dgDataControlOfIndex[pIndex] of group "DataGrid"

- - -dgDataControlOfLine

Returns the long id of the data control associated with a line number.

get the dgDataControlOfLine[pLine] of group "DataGrid"

- - -dgDataOfIndex

Get or set the data associated with a particular index.

get the dgDataOfIndex[pIndex] of group "DataGrid"

set the dgDataOfIndex[pIndex] of group "DataGrid" to <value>

- - -dgDataOfLine

get the dgDataOfLine[pLine] of group "DataGrid" summary: Get or

set the data associated with a particular line.

- - -dgEditMode

Take the data grid into or out of edit mode.

set the dgEditMode of group "DataGrid" to {true | false}

- - -dgFocus

Set to true to focus on a data grid.

set the dgFocus of group "DataGrid" to true

- - -dgFormattedHeight

Returns the formatted height of the data in the data grid.

get the dgFormattedHeight of group "DataGrid"

- - -dgFormattedWidth

Returns the formatted width of the columns in a data grid.

get the dgFormattedWidth of group "DataGrid"

- - -dgHeader

Returns the long id of the group that contains the controls for the table header.

put the dgHeader of group "Data Grid"

- - -dgHeaderAlignment

Get/set the alignment for a column's header.

put the dgHeaderAlignment["col1"] of group "Data Grid"

- - -dgHeaderControl

Returns the long id of the group that contains the controls for a column header.

put the dgHeaderControl of group "Data Grid"

- - -dgHeaderTemplate

Get the control that is used to visually represent the header for a column.

put the dgHeaderTemplate["col1"] of group "Data Grid"

- - -dgHilite

This is a custom property are defined in the behavior script for your template

setProp dgHilite {true | false}

- - -dgHilitedIndexes

Returns a comma delimited list of the indexes that are currently selected.

set the dgHilitedIndexes of group "DataGrid" to pIndex

- - -dgHilitedLines

Returns a comma delimited list of the line numbers that are currently selected.

set the dgHilitedLines of group "DataGrid" to pLine

- - -dgHScroll

Get/set the horizontal scroll of the data grid.

set the dgHScroll to of group "DataGrid" to pInteger

- - -dgHScrollPercent

Get/set the percentage of the horizontal scroll.

set the dgHScrollPercent of group "DataGrid" to pPercent

- - -dgIndex

The index used to uniquely identify the record being displayed in the copy of the template.

get the dgIndex of this control

- - -dgIndexes

Returns the internal list of indexes in the order in which they appear in the data grid.

get the dgIndexes of group "DataGrid"

- - -dgIndexOfLine

Returns the index associated with the given line.

put the dgIndexOfLine[pLine] of group "DataGrid"

- - -dgLine

The line (or row) number that is being displayed in the copy of the template.

get the dgLine of this control

- - -dgLineOfIndex

Returns the line associated with the given index.

put the dgLineOfIndex[pIndex] of group "DataGrid"

- - -dgNumberOfLines

Returns the number of lines displayed in the data grid.

get the dgNumberOfLines of group "DataGrid"

- - -dgNumberOfRecords

For use with fetching data from a database cursor.

set the dgNumberOfRecords of group "DataGrid" to 20

- - -dgRectOfIndex

Get/set the rect of the control associated with the given index

get the dgRectOfIndex[pIndex] of group "DataGrid"

- - -dgRectOfLine

Get/set the rect of the control associated with the given line

get the dgRectOfLine[pLine] of group "DataGrid"

- - -dgText

The dgText property always reflects the same value as the dgData but in tab delimited form.

get the dgText[pIncludeColumnNames] | set the

dgText[pIncludeColumnNames] of group "DataGrid" to 20

- - -dgVisibleLines

Returns the first and last line being displayed in the data grid as a comma delimited list.

get the dgVisibleLines of group "DataGrid"

- - -dgVScroll

Get/set the vertical scroll of the data grid.

set the dgVScroll of group "DataGrid" to pInteger

- - -dgVScrollPercent

Get/set the percentage of the vertical scroll.

set the dgVScrollPercent of group "DataGrid" to pPercent

- - -dim on focusOut

Dims the highlighted lines when the data grid does not have focus.

put the dgProp["dim on focusOut"] of group "Data Grid"

- - -dimmed hilite color

Color that highlighted lines will be when control is not focused.

put the dgProp["dimmed hilite color"] of group "Data Grid"

- - -edit mode action control

Set the action control to display when the data grid is in edit mode.

set the dgProp["edit mode action control"] of group "Data Grid" to

the long id of <control>

- - -edit mode action select control

Set the action select control to display when the data grid is in edit mode.

set the dgProp["edit mode action select control"] of group "Data Grid"

to the long id of <control>

- - -edit mode reorder control

Set the reorder control to display when the data grid is in edit mode.

set the dgProp["edit mode reorder control"] of group "Data Grid" to

the long id of <control>

- - -enable swipe

Turn drag and swipe actions on or off for the data grid.

set the dgProp["enable swipe"] of group "Data Grid" to {true | false}

- - -fixed row height

Set to true if all of your data will be drawn at the same height.

put the dgProp["fixed row height"] of group "Data Grid"

- - -header background color

The background color of the header.

put the dgProp["header background color"] of group "Data Grid"

- - -header background hilite color

The background color of the header that is being sorted by.

put the dgProp["header background hilite color"] of group "Data

Grid"

- - -header height

The height of the header are of the table.

put the dgProp["header height"] of group "Data Grid"

- - -header margins

Specifies the margins to be applied to the fields that display the header text.

put the dgProp["header margins"] of group "Data Grid"

- - -header text color

The text color to apply to the header area of a table.

put the dgProp["header text color"] of group "Data Grid"

- - -header text font

The font to apply to the header area of a table.

put the dgProp["header text font"] of group "Data Grid"

- - -header text size

The text size to apply to the header area of a table.

put the dgProp["header text size"] of group "Data Grid"

- - -header text style

The text style to apply to the header area of a table.

put the dgProp["header text style"] of group "Data Grid"

- - -hilite color

The color to use when highlighting a row.

put the dgProp["hilite color"] of group "Data Grid"

- - -hilited text color

The color to apply to text when a row is highlighted.

put the dgProp["hilited text color"] of group "Data Grid"

- - -htmltext

Set to a string that will be assigned to the htmltext property of the field editor.

set the dgTemplateFieldEditor["htmltext"] of group "Data Grid"

to "<p>Hello World</p>"

- - -left swipe control

Set the control to display when a data grid row is dragged to the right.

set the dgProp["left swipe control"] of group "Data Grid" to the long

id of <control>

- - -multiple lines

Set to true to allow the user to select multiple lines in the data grid.

put the dgProp["multiple lines"] of group "Data Grid"

- - -opaque

Shows or hides the data grid background.

put the dgProp["opaque"] of group "Data Grid"

- - -persistent data

Set to true if you would like the data grid to store the data being displayed between sessions.

put the dgProp["persistent data"] of group "Data Grid"

- - -right swipe control

Set the control to display when a data grid row is dragged to the left.

set the dgProp["right swipe control"] of group "Data Grid" to the long

id of <control>

- - -row color

The primary row color.

put the dgProp["row color"] of group "Data Grid"

- - -row height

This represents the height that your rows will be drawn at.

put the dgProp["row height"] of group "Data Grid"

- - -row template

This is the group that represents a record in your data grid.

put the dgProp["row template"] of group "Data Grid"

- - -rtftext

Set to a string that will be assigned to the rtftext property of the field editor.

put the dgTemplateFieldEditor["rtftext"] of group "Data Grid"

- - -scroll when hscrollbar is hidden

This overrides the default horizontal scrolling behavior.

put the dgProp["scroll when hscrollbar is hidden"] of group

"Data Grid"

- - -scroll when vscrollbar is hidden

This overrides the default vertical scrolling behavior.

put the dgProp["scroll when vscrollbar is hidden"] of group

"Data Grid"

- - -scrollbar corner offset

Scrollbar ofset from the corner when only one is visible.

put the dgProp["scrollbar corner offset"] of group "Data Grid"

- - -scrollbar width

Set the width of the scrollbars

put the dgProp["scrollbar width"] of group "Data Grid"

- - -select text

Set to true to select all text in the field editor.

set the dgTemplateFieldEditor["select text"] of group "Data

Grid" to true

- - -show column dividers

Toggles the visibility of the column dividers in the data display area.

put the dgProp["show column dividers"] of group "Data Grid"

- - -show header

Toggles the visibility of the header. Default value is true.

put the dgProp["show header"] of group "Data Grid"

- - -show hscrollbar

Toggles the visibility of the horizontal scrollbar for a table. True, false or auto.

put the dgProp["show hscrollbar"] of group "Data Grid"

- - -show vscrollbar

Toggles the visibility of the vertical scrollbar. True, false, or auto.

put the dgProp["show vscrollbar"] of group "Data Grid"

- - -sort by column

The column that the table data is currently being sorted by.

put the dgProp["sort by column"] of group "Data Grid"

- - -style

Gets the style of the data grid, either 'form' or 'table'.

put the dgProp["style"] of group "Data Grid"

- - -text

Set to a string that will be assigned to the text property of the field editor.

set the dgTemplateFieldEditor["text"] of group "Data Grid" to

pText

- - -text color

The text color to apply to the data area of a table or form.

put the dgProp["text color"] of group "Data Grid"

- - -text font

The font to apply to the data area of a table or form.

put the dgProp["text font"] of group "Data Grid"

- - -text size

The text size to apply to the data area of a table or form.

put the dgProp["text size"] of group "Data Grid"

- - -text style

The text style to apply to the data area of a table or form.

put the dgProp["text style"] of group "Data Grid"

- - -unicodetext

Set to a string that will be assigned to the unicodetext property of the field editor.

put the dgTemplateFieldEditor["unicodetext"] of group "Data

Grid"

- - -utf8text

Set to a string that will be assigned to the unicodetext property of the field editor after being converted from UTF-8 to UTF16.

put the dgTemplateFieldEditor["utf8text"] of group "Data Grid"

- - -visible columns

Line delimited list of columns in your table that are visible.

put the dgProp["visible columns"] of group "Data Grid"