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 #
Name | Values |
---|---|
SelectionModes | 0 = Single 1 = Multiple |
Constants #
This class exposes no constants.
Events #
Definition | Parameters | Return Type | Description |
---|---|---|---|
BeforeEdit | column as GraffitiGridColumn row as GraffitiGridRow, bounds as Xojo.Rect | Boolean | Raised before an edit operation is set to begin. Return True to cancel. |
CellClick | theRow as GraffitiWebGridRow theColumn as GraffitiGridColumn | None | Fired when the user clicks a cell. |
CellDoubleClick | theRow as GraffitiWebGridRow theColumn as GraffitiGridColumn | None | Fired when the user double-clicks a cell. |
ColumnReorder | theColumn as GraffitiGridColumn oldIndex as Integer newIndex as Integer | None | Fires when the user drags a column to a new position |
ColumnResize | theColumn as GraffitiGridColumn newWidth as Integer | None | Fires when the user resizes a column |
ContextClick | column as GraffitiGridColumn row as GraffitiGridRow x as Integer y as Integer | None | Raised when the user right-clicks the control. Row will be Nil if context-clicking a header. |
DrawCellBackground | theRow as GraffitiWebGridRow theColumn as GraffitiGridColumn g as Graphics as Boolean | 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. |
DrawCellText | theRow as GraffitiWebGridRow theColumn as GraffitiGridColumn g as Graphics as Boolean | 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. |
DrawHeaderBackground | theColumn as GraffitiGridColumn g as Graphics | Boolean | 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. |
DrawHeaderText | theColumn as GraffitiGridColumn g as Graphics as Boolean | 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. |
EditBegun | column as GraffitiGridColumn row as GraffitiGridRow | None | Raised when an edit operation has been started and the UI is completely ready. |
EditCanceled | column as GraffitiGridColumn row as GraffitiGridRow | None | Raised when the user has canceled an edit operation. |
EditCommitted | column as GraffitiGridColumn row as GraffitiGridRow | None | Raised when the user has committed a change to the cell being edited. |
EditKeyDown | key as String | Boolean | Raised when the user presses a key in the cell editor. Return True if handled. |
FormatCellValue | g as Graphics theRow as GraffitiWebGridRow theColumn as GraffitiGridColumn theValue as Variant byRef formattedValue as String as Boolean | None | This event allows you to change the look and content of the text that will be drawn to the cell. |
HeaderClick | theColumn as GraffitiGridColumn as Boolean | None | Raised when the user clicks a header. Return True to cancel built-in functionality. |
MouseMove | X as Integer Y as Integer Row as GraffitiWebGridRow Column as GraffitiGridColumn | None | This event is raised when the mouse is moved. |
RowClick | theRow as GraffitiWebGridRow | None | Raised when the user clicks a row. |
RowDrop | StartIndex as Integer EndIndex as Integer | None | Raised when the user moves a row in the display by dragging. |
Scroll | None | None | Raised when the user scrolls the display. |
Sorted | Column as GraffitiGridColumn | None | Raised when the user sorts a column. |
MouseWheel | x as Integer y as Integer deltaX as Integer deltaY as Integer | None | Raised when the user has attempted to scroll the display using the mouse wheel. Return True to cancel default scroll operations. |
Methods #
Definition | Description |
---|---|
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 GraffitiGridColumn | Search for a column with the ID of theID. |
GetColumnIndex( theCol as GraffitiGridColumn ) as Integer | Search for the column index of the supplied column. |
GetColumnLeft( theCol as GraffitiGridColumn ) as Integer | Get the X position of the supplied column. |
GetColumnLeft( theIndex as Integer ) as Integer | |
GetColumnWidth( theCol as GraffitiGridColumn ) as Integer | Get width of the supplied column. |
GetColumnWidth( theIndex as Integer ) as Integer | |
GetRow( atIndex as Integer ) as GraffitiGridRow | Retrieve the dictionary instance for the supplied row. |
GetRowByTag( theTag as Variant ) as GraffitiGridRow | Retrieve the dictionary instance that has a RowTag equal to theTag. |
GetRowIndex( theRow as GraffitiGridRow ) as Integer | Return the current index of the supplied row. |
GetRowTop( theIndex as Integer ) as Integer | Get 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 Boolean | Returns 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 Variant | Retrieves 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 #
Name | Type | Default Value | Description |
---|---|---|---|
BackgroundColor | Color | &c000000 | The color applied to the background of the entire grid. |
Border | Boolean | False | Draw a border around the grid. |
BorderColor | Color | &c000000 | The color of the border. |
CellBorder | Boolean | False | Border around cells. |
ColumnResize | Boolean | False | Allow user to resize columns. |
CursorIndex | Integer | 0 | Current position of navigation cursor within the grid, a row index. |
CustomColors | Boolean | False | Draw using custom color properties. |
DragReorder | Boolean | False | Allow user to reorder columns by dragging. |
DragReorderRows | Boolean | False | Allow user to reorder rows by dragging. |
EditField | DesktopTextArea | Nil | Control used for text editing operations. |
EditingColumn | GraffitiGridColumn | Nil | Column of current edit operation. Nil if not currently editing. |
EditingRow | GraffitiGridRow | Nil | Row of current edit operation. Nil is not currently editing. |
GradientFills | Boolean | False | When true, the grid will use subtle gradients instead of solid colors to draw components. |
HeaderBorder | Boolean | False | When true, draw a border around all column headers. |
HeaderColor | Color | &c000000 | Background color of the header items when not hovered. |
HeaderDividerColor | Color | &c000000 | Color of border between column headers, as well as between the header and the viewport. |
HeaderDividerLineSize | Integer | 2 | The width of the divider between column headers. |
HeaderHeight | Integer | 30 | The height of the header row. |
HeaderHoverColor | Color | &c000000 | The background color of the header when hovered. |
HeaderHoverTextColor | Color | &c000000 | The text color of the header when hovered. |
HeaderTextBold | Boolean | False | Font weight of the header text. |
HeaderTextColor | Color | &c000000 | Text color of the headers. |
HeaderTextFont | String | “System” | Font used to draw headers. |
HeaderTextSize | Integer | 0 | Font size of headers. |
HeaderTextUnderline | Boolean | False | Applies the underline text decoration. |
LastDrawTime | Double | 0.0 | How long, in seconds, the last redraw took. |
LockUpdate | Boolean | False | When true, the grid will not redraw while making changes. Set to false again to update display. |
MinimumColumnWidth | Integer | 24 | The smallest a column can be. |
RowColor | Color | &c000000 | Background color of even-numbered rows. |
RowColorOdd | Color | &c000000 | Background color of odd-numbered rows. |
RowDividerColor | Color | &c000000 | Color of the divider between rows. |
RowDividerLineSize | Integer | 2 | Height of the divider between rows. |
RowHeight | Integer | 24 | Height of rows. |
RowHoverColor | Color | &c000000 | Background color of rows when mouse is over them. |
RowHoverTextColor | Color | &c000000 | Foreground color of rows when mouse is over them. |
RowSelectedColor | Color | &c000000 | Background color of rows when selected. |
RowSelectedTextColor | Color | &c000000 | Foreground color of rows when selected. |
RowTextBold | Boolean | False | Font weight of rows. |
RowTextColor | Color | &c000000 | Text color of rows. |
RowTextFont | String | “System” | Font used to display row text. |
RowTextItalic | Boolean | False | Italicize row text. |
RowTextSize | Integer | 0 | Size to draw text. |
RowTextUnderline | Boolean | False | Text decoration. |
ScrollbarHorizontal | DesktopScrollbar | Auto-generated | The control that is used as a horizontal scrollbar. |
ScrollbarVertical | DesktopScrollbar | Auto-generated | The control that is used as a vertical scrollbar. |
ScrollPositionX | Integer | 0 | Current horizontal scroll position. |
ScrollPositionY | Integer | 0 | Current vertical scroll position. |
SelectionMode | SelectionModes | SelectionModes.Single | Selection type. |
SortIconColor | Color | &c000000 | Color applied to the sort icon. |
SortIconHoverColor | Color | &c000000 | Color applied to the sort icon on mouse over. |
SystemColors | Boolean | True | When True, attempts to match the colors and UI style used by the system. Dark mode adaptive. |
WrapCellText | Boolean | True | When 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.