Enumerations #
This class exposes no enumerations.
Constants #
This class exposes no constants.
Events #
Definition | Parameters | Return Type | Description |
---|---|---|---|
ContextClick | theItem as GraffitiWebTreeItem | None | Fires when the user right-clicks an item in the display. mouseX and mouseY are relative to the page, not the control. |
mouseX as Integer | |||
mouseY as Integer | |||
ItemChecked | theItem as GraffitiWebTreeItem | Fires when the user checks an item in the display. | |
ItemClicked | theItem as GraffitiWebTreeItem | None | Fires when the user has clicked an item. |
ItemCollapsed | theItem as GraffitiWebTreeItem | None | Fires when the user has collapsed an expandable item. |
ItemContextClicked | item as GraffitiTreeItem | Raised when the user right-clicks an item in the tree. | |
x as Integer | |||
y as Integer | |||
ItemDoubleClicked | theItem as GraffitiWebTreeItem | None | Fires when the user has double-clicked an item. |
ItemEdited | theItem as GraffitiWebTreeItem | None | Fires when the user has finished editing an item. |
ItemExpanded | theItem as GraffitiWebTreeItem | None | Fires when the user has expanded an item. |
ItemIconClicked | theItem as GraffitiWebTreeItem | None | Fires when the user has clicked the icon of an item. |
ItemSelected | theItem as GraffitiWebTreeItem | None | Fires when the user selects an item either with the mouse or keyboard. |
Methods #
Definition | Parameters | Return Type | Description |
---|---|---|---|
AddItem | theItem as GraffitiWebTreeItem | None | Adds an item to the tree. If theParent is Nil, then it is added as a top-level node. AddToParent = True will add it to the Children property of the parent item (mostly for internal use). |
theParent as GraffitiWebTreeItem = Nil | |||
AddToParentItem as Boolean = True | |||
CheckedItems | None | GraffitiTreeItem() | Returns all items at any depth whose Checked property is equal to True. |
CheckItem | theItem as GraffitiWebTreeItem | None | Sets the item’s checkbox value to theValue. |
theValue as Boolean = True | |||
CollapseAll | None | None | Collapse all currently expanded items. |
CollapseItem | theItem as GraffitiWebTreeItem | None | Collapses the supplied item. |
DeselectAll | None | None | Deselect all items. |
DisableItem | theItem as GraffitiWebTreeItem | None | Disables an item, making it uncheckable. |
EditItem | theItem as GraffitiWebTreeItem | None | Makes an item editable. |
EditItemEnd | theItem as GraffitiWebTreeItem | Ends editing of an item. | |
EnableItem | theItem as GraffitiWebTreeItem | None | Enables an item, making it checkable. |
ExpandAll | None | None | Expands all currently expandable items. |
ExpandItem | None | theItem as GraffitiWebTreeItem | Expands the supplied item. |
FindItem | itemText as String | GraffitiWebTreeItem | Finds the first item whose Caption matches itemText. |
FindByUUID | uuid as String | GraffWebTreeItem | Find the first item whose UUID matches uuid. |
inItems() as GraffWebTreeItem | |||
GetDepth | theItem as GraffitiWebTreeItem | Integer | Returns the level depth of the current item. Top-level items will be 1, their children will be 2, etc. |
GetIndexOf | theItem as GraffitiWebTreeItem | Integer | Gets the index of the supplied item within its parent’s Children array, or within the Items array if top-level. |
GetIndexPath | theItem as GraffitiWebTreeItem | String | Returns an index path to the current item. As an example, calling GetIndexPath( myItem, “/” ) will return something like “3/7/1”. |
Separator as String = “/” | |||
GetPath | theItem as GraffitiWebTreeItem | String | Returns the path to the current item using item captions. As an example, calling GetPath( myItem, “/” ) will return something like “Parent1/Parent2/Parent3/MyItem”. |
Separator as String = “/” | |||
HasChildren | theItem as GraffitiWebTreeItem | Boolean | Returns true if the supplied item has children. |
InsertItem | theItem as GraffitiWebTreeItem | None | Inserts theItem before insertBefore. |
insertBefore as GraffitiWebTreeItem | |||
IsChildOf | theItem as GraffitiWebTreeItem | Boolean | Returns true is theItem is a direct child of theParent. |
theParent as GraffitiWebTreeItem | |||
IsFirstChild | theItem as GraffitiWebTreeItem | Boolean | Returns True if theItem is the first child in its parent. |
IsLastChild | theItem as GraffitiWebTreeItem | Boolean | Returns True if theItem is the last child of its parent. |
IsSiblingOf | theItem as GraffitiWebTreeItem | Boolean | Returns True if the two supplied items are siblings. |
theSibling as GraffitiWebTreeItem | |||
IsTopLevel | theItem as GraffitiWebTreeItem | Boolean | Returns True if theItem is a top-level item. |
RemoveAll | None | None | Removes all items from the Tree. |
RemoveItem | theItem as GraffitiWebTreeItem | None | Removes theItem from the tree. If includeChildren is False, then children of theItem are added to theItem’s parent. |
includeChildren as Boolean = True | |||
ScrollTo | theItem as GraffitiWebTreeItem | None | Scrolls to theItem. If it is hidden under collapsed parents, those parents are expanded automatically. |
SelectItem | theItem as GraffitiWebTreeItem | None | Selects the specified item. |
UpdateCaption | theItem as GraffitiWebTreeItem | None | Updates the specified item with newCaption. |
newCaption as String | |||
UpdateIcon | theItem as GraffitiWebTreeItem | None | Updates the specified item with newIcon. |
newIcon as String | |||
UpdateItemStyle | theItem as GraffitiWebTreeItem | None | Updates the tree to show theItem.Style. |
Properties #
Name | Type | Default Value | Description |
---|---|---|---|
AllowEdit | Boolean | False | If True, users will be able to edit the contents of individual rows. NOTE: This property should only be set in the IDE’s Inspector. |
CustomIcons | Boolean | False | If True, icon properties will be used to override defaults. |
IconCheckbox | String | “” | A FontAwesome icon string to use for an empty checkbox. |
IconCheckboxChecked | String | “fa-checked-square-o” | A FontAwesome icon string to use for checked checkboxes. |
IconCheckboxUnknown | String | “fa-square-o” | A FontAwesome icon string to use for checkboxes with an unknown value (IE: if some children, but not all, are selected). |
IconExpanderClosed | String | “fa-caret-down” | A FontAwesome icon string to use as an expander for items with children. |
IconExpanderOpen | String | “fa-caret-right” | A FontAwesome icon string to use as collapser for items with children. |
IconExpanderStyle | GraffitiStyle | Nil | GraffitiStyle applied to item expanders. |
IconStyle | WebStyle | Nil | WebStyle to apply to icons in the tree. |
Items() | GraffitiWebTreeItem | Nil | Items in the tree, editing this directly is not recommended. |
ItemSelStyle | GraffitiStyle | Nil | WebStyle to apply to selected items. |
ItemStyle | GraffitiStyle | Nil | WebStyle to apply to all items. |
LockUpdate | Boolean | False | When true, rows added using AddItem will not update style information until LockUpdate is set to False. This should speed up addition of large amounts of rows. |
RightToLeft | Boolean | False | When true, the Tree will display in RTL fashion. |
SelectedItem | GraffitiWebTreeItem | Nil | The currently selected item. |
Examples #
Creating an Item with a FontAwesome Icon #
GraffitiWebTree provides a constructor for creating items that have a FontAwesome icon to the left of the node’s text.
dim firstItemFirstChild as new GraffitiWebTreeItem( "test child", "fas fa-times" ) firstItemFirstChild.Checkbox = True me.AddItem( firstItemFirstChild, firstItem )
Iterate Items #
As GraffitiWebTree items are maintained in a relational manner (using Parents and Children), iterating items can be a tough concept to grasp. The easiest path is to create a method to do your multi-level iteration and perform a specific function. For instance, the following code will loop through all items in the tree and give you an opportunity to do something with the individual item’s CheckValue property:
Private Sub StoreCheckValues(ofTree as GraffitiWebTree, inNode as GraffitiWebTreeItem = Nil) dim arrCheck() as GraffitiWebTreeItem if not IsNull( inNode ) Then arrCheck = inNode.Children else arrCheck = ofTree.Items end if dim intCycle as Integer dim intMax as Integer = arrCheck.Ubound '// Note that you will want to perform the same operation on the parent ' before the loop if you're providing inNode and want its value recorded. dim currentItem as GraffitiWebTreeItem for intCycle = 0 to intMax currentItem = arrCheck(intCycle) if currentItem.Checkbox then '// Has a checkbox '// Store the value of CheckValue end if '// The following line will iterate over the children of currentItem. ' If you only want to do top-level children then you can comment this ' or add a method parameter and check it here. if currentItem.Children.Ubound >= 0 then StoreCheckValues( ofTree, currentItem ) next End Sub
Then you would simply call the method and pass in your tree to iterate through all items:
StoreCheckValues(myTreeInstance)
Or, if you only want to iterate over a specific branch of the tree:
StoreCheckValues(myTreeInstance, myBranchTreeItem)