# GraffitiTreeView
Class Inherits GraffitiSuite.BaseCanvas
## About
An amazingly versatile and powerful TreeView control with both a modern style and a classic style.Features:
*
Drag/Drop
*
Checkboxes
*
Remove Button
*
Full color customization
## Preview


Previous
Next
## Compatibility
### Framework API Version
| 1.0 | 2.0 |
| :---: | :---: |
| True | True |
### Desktop
| 32-Bit | 64-Bit |
| :---: | :---: |
| True | True |
## Attributes
| Name | Value |
| --- | --- |
| DefaultEvent | "Opening" |
## Enumerations
| Name | Value | Description |
| --- | :---: | --- |
| Alignments | Left <br> Center <br> Right | Supported alignments. |
| DropPositions | Above <br> On <br> Below | Support drop results. |
| Styles | Modern <br> Classic <br> Dark | Supported drawing styles. |
## Delegates
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| Function | FromJSONCallback | (None) | Delegate function that is called when loading data from JSON for properties whose values are not supported by JSON. IE: Icon, Tag |
| Function | ToJSONCallback | (None) | Delegate function that is called when writing data to JSON for properties whose values are not supported by JSON. IE: Icon, Tag |
## Event Definitions
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| ColumnResized | index as Integer | (None) | Raised when the user resizes a column. |
| DrawNodeBackground | node as GraffitiTreeViewNode <br> g as Graphics | Boolean | Raised any time a cell background is being drawn. Return True to override default behavior. |
| DrawNodeText | node as GraffitiTreeViewNode <br> column as Integer <br> g as Graphics <br> text as String <br> x as Integer <br> y as Integer <br> maxWidth as Integer | Boolean | Raised any time a cell text is being drawn. Return True to override default behavior. |
| MouseDown | X as Integer <br> Y as Integer | Boolean | |
| MouseDrag | node as GraffitiTreeViewNode <br> X as Integer <br> Y as Integer | (None) | |
| MouseEnterNode | theNode as GraffitiTreeViewNode | (None) | Is fired when the mouse enters the drawable area of a GraffitiTreeViewNode. |
| MouseExitNode | theNode as GraffitiTreeViewNode | (None) | Fires when the mouse exits the drawable area of a GraffitiTreeViewNode. |
| MouseUp | X as Integer <br> Y as Integer | (None) | |
| NodeCollapse | theNode as GraffitiTreeViewNode | Boolean | Signals that a TreeViewNode is to be collapsed. Return True to allow. |
| NodeDoubleClick | theNode as GraffitiTreeViewNode | (None) | Fired when a node has been double clicked. |
| NodeDrag | node as GraffitiTreeViewNode <br> target as GraffitiTreeViewNode <br> position as GraffitiTreeView.DropPositions | Boolean | Controls display of the drop indicator in node drag operations. Return True to omit drawing drop indicator. |
| NodeDrop | node as GraffitiTreeViewNode <br> target as GraffitiTreeViewNode <br> position as GraffitiTreeView.DropPositions | Boolean | Controls whether a node drop target is valid. Return True to cancel the drop operation. |
| NodeEditBegin | theNode as GraffitiTreeViewNode | (None) | This event signals that the user has clicked the edit icon on a node. |
| NodeEditCanceled | theNode as GraffitiTreeViewNode | (None) | Fires when the user cancels editing of a node. |
| NodeEditComplete | theNode as GraffitiTreeViewNode | (None) | Signals that the user has completed editing a TreeViewNode. |
| NodeExpand | theNode as GraffitiTreeViewNode | Boolean | Signals that a TreeViewNode is to been expanded. Return True to allow. |
| Deprecated = "SelectionChanged" | Event | theNodes() as GraffitiTreeViewNode) | Fires when the MutliSelect property is True. |
| NodeRemove | theNode as GraffitiTreeViewNode | Boolean | Fires when the user has clicked the remove icon of a TreeViewNode. |
| Deprecated = "SelectionChanged" | Event | theNode as GraffitiTreeViewNode) | Is fired to notify that the user has selected a different node (or deselected the previously selected node). Only when MultiSelect = False. |
| NodeValueChange | theNode as GraffitiTreeViewNode | (None) | Fires to notify that the user has changed the node's boolean value. |
| Opening | (None) | (None) | |
| RightClick | theNode as GraffitiTreeViewNode | (None) | Signals that the user has right-clicked theNode. |
| SelectionChanged | (None) | (None) | Raised when the selection has changed, |
## Methods
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| Attributes | Deprecated = "AddNode" | AddChildNode | Adds a new child to the specified parent. |
| Sub | AddNode | (None) | Adds a new top-level node. |
| Sub | AddNode | (None) | Appends theNode to the display |
| Sub | CollapseNode | (None) | Collapses the node to hide all children. |
| Sub | CollapseNode | (None) | Collapses a node by searching for text. |
| Function | ColumnWidth | As | Returns the width of the specified column. |
| Sub | ColumnWidth | (None) | Sets the width of the specified column. |
| Sub | DeselectAll | (None) | Deselects all nodes to N depth. |
| Sub | EditCurrentNode | (None) | Makes the currently selected node editable. |
| Sub | EditNode | (None) | Makes the specified node editable. |
| Sub | ExpandNode | (None) | Expands the specified node. |
| Sub | ExpandNode | (None) | Expands a node by searching for text. |
| Sub | FromJSON | (None) | Loads nodes from a JSON array. |
| Function | GetCheckedNodes | As | Returns an array of all checked nodes, regardless of depth. |
| Function | GetCheckedNodes | As | Returns an array of all checked nodes that are direct or indirect children of the ofParent node. |
| Function | GetColumnFromX | As | Returns the index of the column at the specified X position. |
| Function | GetNodeByTag | As | Returns the first matching node by tag. |
| Function | GetNodeByText | As | Returns the first matching node by text. |
| Function | GetNodeFromXY | As | Gets the node that is currently drawn at (X, Y). |
| Function | GetNodeFromY | As | Returns the node that is currently drawn at the specified Y position. |
| Attributes | Deprecated = "SelectedNodes" | GetSelectedNodes | Returns all currently selected nodes. |
| Function | GetVisibleNodeByText | As | Returns the currently visible node with theText. |
| Sub | InsertNode | (None) | Inserts a new node. |
| Function | LastNodeIndex | As | Returns the last top-level node index. |
| Function | Node | As | Returns the top-level node at the specified index. |
| Sub | RemoveAllNodes | (None) | Removes all nodes from fromNode, or top-level if ofNode = Nil. |
| Sub | RemoveNode | (None) | Removes the specified node regardless of parent or depth. |
| Sub | RemoveNode | (None) | Removes the top-level node at the specified index. |
| Sub | ScrollTo | (None) | Scrolls the display to show the specified node. |
| Function | SearchNodes | As | Returns all nodes whose text matches SearchText. |
| Sub | SelectAll | (None) | Selects all nodes regardless of depth. |
| Function | SelectedNodes | As | Returns all selected nodes, regardless of depth. |
| Sub | SetNodeChecked | (None) | Sets the checked value of the specified node. If IsText = True, then NodeTextOrTag should be the node's text. |
| Sub | SetNodeNotifications | (None) | Sets the notification display count on the node's icon. If >10, an exclamation point is displayed. |
| Sub | SetNodeNotifications | (None) | Sets the notification display count on the node's icon. If >10, an exclamation point is displayed. |
| Sub | SetNodeSelected | (None) | Sets the selection of the specified node. If IsText = True, then NodeTextOrTag should be the node's text. |
| Sub | SetNodeSelected | (None) | Sets the selection of the specified node. If IsText = True, then NodeTextOrTag should be the node's text. |
| Function | ToJSON | As | Converts all child nodes to JSON array for easy storage. |
## Properties
| Name | Type | Default Value | Description |
| --- | :---: | :---: | --- |
| AllowColumnResize | Boolean | Nil | Determines whether columns can be resized by the user dragging from the right edge of a column. |
| AllowDeselect | Boolean | Nil | Determines if the user is allowed to deselect all nodes by clicking outside the rows. |
| BackgroundColor | Color | Nil | Background color of the control. |
| BorderColor | Color | Nil | Border color of the control. |
| CanDrag | Boolean | Nil | Determines whether to enable functionality to drag nodes from the component to other controls. |
| CheckColor | Color | Nil | Color used to checkboxes. |
| CheckHoverColor | Color | Nil | Color used to draw checkboxes when the mouse if over them. |
| CheckSelectedColor | Color | Nil | Color used to draw checkboxes with a state of True. |
| ColumnCount | Integer | Nil | Number of columns. |
| ColumnWidthMaximum | Integer | Nil | Maximum column width as a result of resize. |
| ColumnWidthMinimum | Integer | Nil | Minimum column width as a result of resize. |
| ColumnWidths | String | Nil | String representing the columns widths. |
| CustomColors | Boolean | Nil | If the control is to use the specified custom color properties. |
| CustomPictures | Boolean | Nil | If the control is to use the specified custom picture properties. |
| Editor | DesktopTextField | Nil | TextField instance used for node editing. |
| ExpanderColor | Color | Nil | Default color for expanders when not hovered of selected. |
| ExpanderHoverColor | Color | Nil | Color for expanders when hovered. |
| ExpanderSelectedColor | Color | Nil | Color for expanders when the row is selected. |
| FullRowSelect | Boolean | Nil | Whether the control displays selections spanning the full row, or just the caption. |
| HasHeader | Boolean | Nil | Whether the control displays a large hearder. |
| HeaderAlignment | Alignments | Nil | Alignment of header text. |
| HeaderColor | Color | Nil | Background color of the header. |
| HeaderHeight | Integer | Nil | Height of the header. |
| HeaderText | String | Nil | Text to displayed in the header. |
| HeaderTextColor | Color | Nil | Color of text in the header. |
| HeaderTextFont | String | Nil | Font of text in the header. |
| HeaderTextSize | Integer | Nil | Size, in points, of the header text. |
| HorizontalScroll | DesktopScrollbar | Nil | Horizontal scrollbar. |
| IconChecked | Picture | Nil | Picture representation of node's checkbox with it's Value set to true. |
| IconCheckedHover | Picture | Nil | Picture representation of node's checkbox when hovered. |
| IconCheckedSelected | Picture | Nil | Picture representation of node's checkbox when the row is selected. |
| IconFolderCollapsed | Picture | Nil | Picture representation of node's expander when collapsed. |
| IconFolderCollapsedHover | Picture | Nil | Picture representation of node's expander when collapsed and hovered. |
| IconFolderCollapsedSelected | Picture | Nil | Picture representation of node's expander when collapsed and selected. |
| IconFolderExpanded | Picture | Nil | Picture representation of node's expander when expanded. |
| IconFolderExpandedHover | Picture | Nil | Picture representation of node's expander when expanded and hovered. |
| IconFolderExpandedSelected | Picture | Nil | Picture representation of node's expander when expanded and selected.. |
| IconRemove | Picture | Nil | Picture to show for the remove action. |
| IconRemoveHover | Picture | Nil | Picture to show when the remove button is hovered. |
| IconRemoveSelected | Picture | Nil | Picture to show when the remove button's row is selected. |
| IconReorder | Picture | Nil | Picture to show for the reorder button. |
| IconReorderHover | Picture | Nil | Picture to show for the reorder button when hovered. |
| IconReorderSelected | Picture | Nil | Picture to show for the reorder button when the row is selected. |
| IconUnchecked | Picture | Nil | Picture representation of node's checkbox with it's Value set to false. |
| IconUncheckedHover | Picture | Nil | Picture representation of node's checkbox with it's Value set to false and hoevered. |
| IconUncheckedSelected | Picture | Nil | Picture representation of node's checkbox with it's Value set to false and the row is selected. |
| ListIndex | Integer | Nil | Current selection row index. |
| LockUpdate | Boolean | Nil | |
| MultiSelect | Boolean | Nil | If a user may select more than one node/row. |
| NotificationColor | Color | Nil | Background color of notification icon. |
| NotificationTextColor | Color | Nil | Text color of notification icon. |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | | GraffitiTreeViewNode | |
| Private | | Picture | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | = | |
| Private | | GraffitiTreeViewNode | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | | Integer | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| RemoveColor | Color | Nil | Color of remove icon. |
| RemoveHoverColor | Color | Nil | Remove icon color when hovered. |
| RemoveSelectedColor | Color | Nil | Remove icon color when selected. |
| ReorderColor | Color | Nil | Color of reorder icon. |
| ReorderHoverColor | Color | Nil | Reorder icon color when hovered. |
| ReorderSelectedColor | Color | Nil | Reorder icon color when selected. |
| RowColor | Color | Nil | Background color of rows. |
| RowColorAlt | Color | Nil | Background color of alternating rows. |
| RowHeight | Integer | Nil | Height of rows. |
| RowHoverColor | Color | Nil | Background color when row is hovered. |
| RowHoverTextColor | Color | Nil | Text color when row is hovered. |
| RowTextColor | Color | Nil | Text color of rows. |
| RowTextFont | String | Nil | Font used to display node captions. |
| RowTextSize | Integer | Nil | Text size, in points, of nodes. |
| ScrollMax | Integer | Nil | Maximum scroll position. |
| ScrollMaxH | Integer | Nil | Maximum horizontal scroll position. |
| ScrollPosition | Integer | Nil | Current scroll position. |
| ScrollPositionH | Integer | Nil | Current horizontal scroll position. |
| SelectedRowColor | Color | Nil | Background color of selected row. |
| SelectedRowTextColor | Color | Nil | Text color of selected row. |
| ShowBorder | Boolean | Nil | When True, a border is drawn around the edge of the control. |
| Style | Styles | Nil | The style to apply to the tree's drawing. |
| VerticalScroll | DesktopScrollbar | Nil | The VerticalScrollBar instance to be used. |