GraffitiGrid

Images #

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, and much more.

Enumerations #

NameValues
SelectionModes0 = Single
1 = Multiple

Constants #

This class exposes no constants.

Events #

DefinitionParametersDescription
BeforeEditcolumn as GraffitiGridColumn
row as GraffitiGridRow, bounds as Xojo.Rect
Raised before an edit operation is set to begin. Return True to cancel.
CellClicktheRow as GraffitiWebGridRow
theColumn as GraffitiGridColumn
Fired when the user clicks a cell.
CellDoubleClicktheRow as GraffitiWebGridRow
theColumn as GraffitiGridColumn
Fired when the user double-clicks a cell.
ColumnReordertheColumn as GraffitiGridColumn
oldIndex as Integer
newIndex as Integer
Fires when the user drags a column to a new position
ColumnResizetheColumn as GraffitiGridColumn
newWidth as Integer
Fires when the user resizes a column
ContextClickcolumn as GraffitiGridColumn
row as GraffitiGridRow
x as Integer
y as Integer
Raised when the user right-clicks the control. Row will be Nil if context-clicking a header.
DrawCellBackgroundtheRow as GraffitiWebGridRow
theColumn as GraffitiGridColumn
g as Graphics as Boolean
This event is raised before a cell’s background is drawn and provides the opportunity to override the class’s behavior. Return True if you draw to the graphics property here.
DrawCellTexttheRow as GraffitiWebGridRow
theColumn as GraffitiGridColumn
g as Graphics as Boolean
This event is raised before a cell’s text is drawn and provides the opportunity to override the class’s behavior. Return True if you draw to the graphics property here.
DrawHeaderBackgroundtheColumn as GraffitiGridColumn
g as Graphics
This event is raised before a header’s background is drawn and provides the opportunity to override the class’s behavior. Return True if you draw to the graphics property here.
DrawHeaderTexttheColumn as GraffitiGridColumn
g as Graphics as Boolean
This event is raised before a header’s text is drawn and provides the opportunity to override the class’s behavior. Return True if you draw to the graphics property here.
EditBeguncolumn as GraffitiGridColumn
row as GraffitiGridRow
Raised when an edit operation has been started and the UI is completely ready.
EditCanceledcolumn as GraffitiGridColumn
row as GraffitiGridRow
Raised when the user has canceled an edit operation.
EditCommittedcolumn as GraffitiGridColumn
row as GraffitiGridRow
Raised when the user has committed a change to the cell being edited.
FormatCellValueg as Graphics
theRow as GraffitiWebGridRow
theColumn as GraffitiGridColumn
theValue as Variant
byRef formattedValue as String as Boolean
This event allows you to change the look and content of the text that will be drawn to the cell.
HeaderClicktheColumn as GraffitiGridColumn as BooleanRaised when the user clicks a header. Return True to cancel built-in functionality.
MouseMoveX as Integer
Y as Integer
Row as GraffitiWebGridRow
Column as GraffitiGridColumn
This event is raised when the mouse is moved.
RowClicktheRow as GraffitiWebGridRowRaised when the user clicks a row.
RowDropStartIndex as Integer
EndIndex as Integer
Raised when the user moves a row in the display by dragging.
ScrollNoneRaised when the user scrolls the display.
SortedColumn as GraffitiGridColumnRaised when the user sorts a column.
MouseWheelx as IntegerRaised when the user has attempted to scroll the display using the mouse wheel. Return True to cancel default scroll operations.
y as Integer
deltaX as Integer
deltaY as Integer

Methods #

DefinitionDescription
AddColumn( theColumn as GraffitiGridColumn )Adds a column to the grid.
AddRow( theRow as GraffitiGridRow )Adds a row to the grid.
AddRows( rows() as GraffitiGridRow ) 
DeselectAllRows()Deselect all currently selected rows.
DeselectRow( atIndex as Integer )Deselect a specific row.
DeselectRow( theRow as GraffitiGridRow )
EditCell( theRow as GraffitiGridRow, theColumn as GraffitiGridColumn )Begin editing of the specified row.
EditCell( theRow as Integer, theColumn as Integer )
GetColumnByID( theID as String ) as GraffitiGridColumnSearch for a column with the ID of theID.
GetColumnIndex( theCol as GraffitiGridColumn ) as IntegerSearch for the column index of the supplied column.
GetColumnLeft( theCol as GraffitiGridColumn ) as IntegerGet the X position of the supplied column.
GetColumnLeft( theIndex as Integer ) as Integer
GetColumnWidth( theCol as GraffitiGridColumn ) as IntegerGet width of the supplied column.
GetColumnWidth( theIndex as Integer ) as Integer
GetRow( atIndex as Integer ) as GraffitiGridRowRetrieve the dictionary instance for the supplied row.
GetRowByTag( theTag as Variant ) as GraffitiGridRowRetrieve the dictionary instance that has a RowTag equal to theTag.
GetRowIndex( theRow as GraffitiGridRow ) as IntegerReturn the current index of the supplied row.
GetRowTop( theIndex as Integer ) as IntegerGet the Y position of the specified row.
GetRowTop( theRow as GraffitiGridRow ) as Integer
InsertColumn( atIndex as Integer, theColumn as GraffitiGridColumn )Inserts a new column at atIndex.
InsertRow( atIndex as Integer, theRow as GraffitiGridRow )Inserts a new row at atIndex.
InvalidateAllRows()Force all rows to redrawn, regardless of their previous state.
InvalidateRow( atIndex as Integer )Force the row at atIndex to be redrawn, regardless of previous state.
IsRowSelected( rowIndex as Integer ) as BooleanReturns True if the specified row is currently selected.
IsRowSelected( theRow as GraffitiGridRow ) as Boolean
RemoveAllRows()Removes all rows from the Grid.
RemoveColumn( atIndex as Integer )Removes the specified column from the display.
RemoveColumn( theColumn as GraffitiGridColumn )
RemoveRow( atIndex as Integer )Remove the specified row.
RemoveRow( theRow as GraffitiGridRow )
RowCount()Returns a count of all the rows in the Grid.
RowTag( theRow as GraffitiGridRow ) as VariantRetrieves the RowTag of the specified row.
RowTag( theRow as Integer ) as Variant
RowTag( theRow as GraffitiGridRow, Assigns newTag as Variant )Sets the row tag of the specified row.
RowTag( theRow as Integer, Assigns newTag as Variant )
ScrollIntoView( theIndex as Integer )Scrolls the specified row in to view.
ScrollIntoView( theRow as GraffitiGridRow )
ScrollTo( X as Integer, Y as Integer )Scrolls the display to the specified position.
SelectAllRows()Select all rows.
SelectedRows() as GraffitiGridRow()Returns an array containing the currently selected rows.
SelectRow( atIndex as Integer )Select the specified row.
SelectRow( theRow as GraffitiGridRow )
SortData( theCol as GraffitiGridColumn )Causes the grid to re-sort the data in the provided column.
UpdateCell( theRow as GraffitiGridRow, theColumn as GraffitiGridColumn, newValue as Variant )Update the cell value specified and redraw the row.
UpdateRows()Invalidate all rows, causing them to be redrawn.

Properties #

NameTypeDefault ValueDescription
BackgroundColorColor&c000000The color applied to the background of the entire grid.
BorderBooleanFalseDraw a border around the grid.
BorderColorColor&c000000The color of the border.
CellBorderBooleanFalseBorder around cells.
ColumnResizeBooleanFalseAllow user to resize columns.
CursorIndexInteger0Current position of navigation cursor within the grid, a row index.
CustomColorsBooleanFalseDraw using custom color properties.
DragReorderBooleanFalseAllow user to reorder columns by dragging.
DragReorderRowsBooleanFalseAllow user to reorder rows by dragging.
EditFieldDesktopTextAreaNilControl used for text editing operations.
GradientFillsBooleanFalseWhen true, the grid will use subtle gradients instead of solid colors to draw components.
HeaderBorderBooleanFalseWhen true, draw a border around all column headers.
HeaderColorColor&c000000Background color of the header items when not hovered.
HeaderDividerColorColor&c000000Color of border between column headers, as well as between the header and the viewport.
HeaderDividerLineSizeInteger2The width of the divider between column headers.
HeaderHeightInteger30The height of the header row.
HeaderHoverColorColor&c000000The background color of the header when hovered.
HeaderHoverTextColorColor&c000000The text color of the header when hovered.
HeaderTextBoldBooleanFalseFont weight of the header text.
HeaderTextColorColor&c000000Text color of the headers.
HeaderTextFontString“System”Font used to draw headers.
HeaderTextSizeInteger0Font size of headers.
HeaderTextUnderlineBooleanFalseApplies the underline text decoration.
LastDrawTimeDouble0.0How long, in seconds, the last redraw took.
LockUpdateBooleanFalseWhen true, the grid will not redraw while making changes. Set to false again to update display.
MinimumColumnWidthInteger24The smallest a column can be.
RowColorColor&c000000Background color of even-numbered rows.
RowColorOddColor&c000000Background color of odd-numbered rows.
RowDividerColorColor&c000000Color of the divider between rows.
RowDividerLineSizeInteger2Height of the divider between rows.
RowHeightInteger24Height of rows.
RowHoverColorColor&c000000Background color of rows when mouse is over them.
RowHoverTextColorColor&c000000Foreground color of rows when mouse is over them.
RowSelectedColorColor&c000000Background color of rows when selected.
RowSelectedTextColorColor&c000000Foreground color of rows when selected.
RowTextBoldBooleanFalseFont weight of rows.
RowTextColorColor&c000000Text color of rows.
RowTextFontString“System”Font used to display row text.
RowTextItalicBooleanFalseItalicize row text.
RowTextSizeInteger0Size to draw text.
RowTextUnderlineBooleanFalseText decoration.
ScrollbarHorizontalDesktopScrollbarAuto-generatedThe control that is used as a horizontal scrollbar.
ScrollbarVerticalDesktopScrollbarAuto-generatedThe control that is used as a vertical scrollbar.
ScrollPositionXInteger0Current horizontal scroll position.
ScrollPositionYInteger0Current vertical scroll position.
SelectionModeSelectionModesSelectionModes.SingleSelection type.
SortIconColorColor&c000000Color applied to the sort icon.
SortIconHoverColorColor&c000000Color applied to the sort icon on mouse over.
SystemColorsBooleanTrueWhen True, attempts to match the colors and UI style used by the system. Dark mode adaptive.
WrapCellTextBooleanTrueWhen True, string values will wrap when too long to fit horizontally within their cell.

Examples #

There are currently no examples for this class.

Notes #

Embedded Containers and Transparency #

Embedded ContainerControls must have their Transparent property set to False. On Windows, setting this to True causes a litany of issues, but GraffitiGrid simulates transparency on containers by setting the Backdrop of the ContainerControl to the content of the space it occupies on the Grid. This allows ContainerControls that are embedded to display the Hover or Selection color, or allows you to perform other customizations in the Draw* events.