GraffitiGrid

Preview #

About #

GraffitiGrid is a fully-custom listbox control complete with custom cell types and events for drawing the most complex list of data you can dream up. Supports embedding controls and containers, custom row and header rendering, frozen columns, and much more.

Enumerations #

NameValues
CellBorderTypesNone
Left
Right
Both
RowBorderTypesNone
Top
Bottom
Both
SelectionTypesSingle
Multiple

Constants #

This object exposes no constants.

Events #

NameParametersReturn TypeDescription
CellDrawBackgroundg as Graphics
column as GraffitiGridColumn
row as GraffitiGridRow
BooleanRaised when the cell background is being drawn. Return True to cancel default drawing.
CellDrawValueg as Graphics
column as GraffitiGridColumn
row as GraffitiGridRow
BooleanRaised when the cell value is being drawn. Return True to cancel default drawing.
CellPressedcolumn as GraffitiGridColumn
row as GraffitiGridRow
NoneRaised when the user presses a cell.
CellValueChangedcolumn as GraffitiGridColumn
row as GraffitiGridRow
NoneRaised when the user has changed the value of a cell by editing.
ColumnSortedcolumn as GraffitiGridColumnNoneRaised after the Grid’s rows have been sorted by pressing a column’s header.
HeaderCellDrawBackgroundg as Graphics
column as GraffitiGridColumn
BooleanRaised when the specified column header is being drawn. Return True to cancel default drawing.
HeaderCellDrawTextg as Graphics,
column as GraffitiGridColumn
BooleanRaised when the specified column header is being drawn. Return True to cancel default drawing.
HeaderPressedcolumn as GraffitiGridColumnBooleanRaised when the user presses a column’s header. Return True to cancel sorting if enabled.
RowDrawBackgroundg as graphics
row as GraffitiGridRow
BooleanRaised when the background of a row is being drawn. Return True to cancel default drawing.
ScrollPositionChangedNoneNoneRaised when the user has scrolled the Grid by dragging.
SelectionChangedNoneNoneRaised when the user has changed which row(s) within the Grid are selected.

Methods #

NameParametersReturn TypeDescription
AddColumncolumn as GraffitiGridColumnNoneAdd the specified column.
AddColumnAtindex as Integer
column as GraffitiGridColumn
NoneAdd the specified column at the supplied index.
AddColumnscolumns() as GraffitiGridColumnNoneAdds the specified columns.
AddColumnsParamArray columns() as GraffitiGridColumnNoneAdds the specified columns.
AddRowrow as GraffitiGridRowNoneAdds the specified row.
AddRowAtindex as Integer
row as GraffitiGridRow
NoneAdds the specified row at the supplied index.
AddRowsrows() as GraffitiGridRowNoneAdds the specified rows.
AddRowsParamArray rows() as GraffitiGridRowNoneAdds the specified rows.
ColumnAtindex as IntegerGraffitiGridColumnReturns the column at the specified index.
DeselectAllRowsNoneNoneDeselects all rows in the Grid.
EditBegincolumn as GraffitiGridColumn
row as GraffitiGridRow
NoneEnters edit mode for the specified cell.
EditCancelNoneNoneCancels the current edit operation, if any.
EditCommitNoneNoneCommits changes on any current edit operation, if any.
FirstVisibleRowIndexNoneIntegerReturns the index of the first row visible in the Grid’s viewport.
IndexOfColumncolumn as GraffitiGridColumnIntegerReturns the index of the supplied column.
IndexOfRowrow as GraffitiGridRowIntegerReturns the index of the supplied row.
InvalidateAllRowsNoneNoneSignals that all rows should be redrawn then refreshes the display.
InvalidateHeaderNoneNoneSignals that all columns headers should be redrawn then refreshes the display.
InvalidateRowrow as GraffitiGridRowNoneSingals that the specified row should be redrawn then refreshes the display.
LastColumnIndexNoneIntegerReturns the index of the last column within the internal columns array.
LastRowIndexNoneIntegerReturns the index of the last row within the internal rows array.
LastVisibleRowIndexNoneIntegerReturns index of the last row visible within the Grid’s viewport.
RemoveAllColumnsNoneNoneRemoves all columns from the Grid.
RemoveAllRowsNoneNoneRemoves all rows from the Grid.
RemoveColumncolumn as GraffitiGridColumnNoneRemoves the specified column.
RemoveColumnAtindex as IntegerNoneRemoves the column at the specified index.
RemoveRowrow as GraffitiGridRowNoneRemoves the specified row.
RemoveRowAtindex as IntegerNoneRemoves the row at the specified index.
RowAtindex as IntegerGraffitiGridRowReturns the row at the specified index within the internal row array.
ScrollTocolumn as GraffitiGridColumn
row as GraffitiGridRow
NoneScrolls to the specified location. Column or Row may be Nil, but not both.
ScrollToposition as Xojo.PointNoneScrolls to the specified (X, Y) position.
ScrollToBottomNoneNoneScrolls to the maximum Y position.
ScrollToTopNoneNoneScrolls to the minimum Y position.
SelectAllRowsNoneNoneSelects all currently added rows.
SelectedRowsNoneGraffitiGridRow()Returns all currently selected rows.

Properties #

NameTypeDefault ValueDescription
AllowDragReorderRowsBooleanFalseControls whether users may long-press and drag to reorder rows.
AllowDragReorderColumnsBooleanFalseControls whether users may long-press and drag to reorder columns.
BackgroundColorColorGroupNilColorGroup applied to the background of the Grid.
BorderColorColorGroupNilColorGroup applied to the outside edge of the Grid.
CellBorderColorColorGroupNilColorGroup applied to cell borders.
CellBorderTypeCellBorderTypesCellBorderTypes.NoneDetermines which borders to draw on cells.
CurrentEditorGraffitiGridCellEditorNilInstance of the currently active cell editor. Only non-Nil during edit operations.
DefaultRowHeightInteger24Default row height. Overridden by individual GraffitiGridRow.Height properties.
FrozenBackgroundColorColorGroupNilColorGroup applied to the background of the left panel when there are frozen columns.
HeaderBackgroundColorColorGroupNilColorGroup applied to the background of the header row.
HeaderRowHeightDouble24Height of the header row.
IsEditableBooleanFalseControls whether users may double-press cells to edit them when an appropriate cell editor is available.
IsHeaderVisibleBooleanFalseControls whether the column header row is visible.
LockUpdateBooleanFalseControls whether redraw operations should be carried out as a result of changes to data or properties. Typically used to speed up data loading.
ParentScreenMobileScreenNilThe current parent screen of the Grid. Must be set for editing and control embedding.
RowBorderColorColorGroupNilColorGroup applied to row borders.
RowBorderTypeRowBorderTypesRowBorderTypes.NoneDetermines which borders to draw on rows.
RowColorEvenColorGroupNilColorGroup applied to the background of even-indexed rows.
RowColorOddColorGroupNilColorGroup applied to the background odd-indexed rows.
ScrollMaximum (READ-ONLY)Xojo.PointNilMaximum X and Y scroll positions.
ScrollPositionXojo.PointNilCurrent X and Y scroll positions. Replace value to alter rather than altering properties of existing object.
SelectedRowColorColorGroupNilColorGroup applied to the background of selected rows.
SelectionTypeSelectionTypesSelectionTypes.SingleControls how many rows may be selected by the user. When value is Multiple, taps alternate row selection.

Notes #

ParentScreen Requirement #

In order to enable editing and control/container embedding, the ParentScreen property must be set to the parent MobileScreen of the control. Failure to do so may result in exceptions or missing functionality. Set this property as the first operation in the Opening event handler.