CwTreeView
CwTreeView displays a hierarchical list of items.
Protocol
Protocols can be divided into several groups:
o pertaining to creation
o pertaining to the tree view
o pertaining to a node contained in the tree. Those tabs are instances of CwTreeNode.
Creation
createTreeNode: theName argBlock: argBlock
add a CwTreeNode as a child of the receiver.
Tree View
deleteAllItems
Delete all the nodes from the receiver and release all OS resources associated with the nodes .
deleteItem: anItem
Delete the node from the receiver and release all OS resources associated with the item.
deleteItems: anOrderedCollection
Delete the specified items from the receiver and release all OS resources associated
deselectAllItems
Unhighlight and remove all nodes from the selected items list of the receiver.
indentation
Answer the amount each node is indented.
indentation: anInteger
Set the amount each node is indented.
roots
Answer the roots of the receiver.
selectedItems
Answer a list of the selected items in the receiver.
showImages
Answer whether images are displayed in addition to labels.
showImages: aBoolean
Set whether images are displayed in addition to labels.
showItem: anItem
Set whether a node is visible in the receiver.
showLines: aBoolean
Set whether to display lines between the nodes.
showPlusMinus: aBoolean
Set whether to display the plus/minus icons in addition to the labels of the nodes.
showRootLines: aBoolean
Set whether to display lines between the roots.
visibleItemCount: anInteger
Set how many nodes can fit in the visible space of the receiver.
Nodes
Answer the image displayed by the receiver.
image: aCgPixmap
Set the image displayed by the receiver.
index: anInteger
Set the position of the receiver relative to its parent node.
items
Answer the root nodes in the receiver.
numItems
Answer the number of root nodes in the receiver.
parentNode
Answer the parent nodes of the receiver.
parentNode: aTreeNode
Set the parent nodes of the receiver.
root
Answer the root node of the receiver.
selectedImage
Answer the image that is displayed when the receiver is selected.
selectedImage: aPixmap
Set the image that is displayed when the receiver is selected.
showPlusMinus
Answer whether the receiver displays plus/minus to indicate it has children.
showPlusMinus: aBoolean
Set whether the receiver displays plus/minus to indicate it has children.
Callbacks and Events
The progress bar has no callbacks or events specific to it.
collapse
executes when a default action happens on an expanded node. the call data object is CwValueCallbackData
expand
executes when a default action happens on an expanded node. the call data object is CwValueCallbackData
singleSelect
executed when a node is clicked. The call data object is CwAnyCallbackData.
Example
| treeView motherNode images icon selectedIcon |
"Create the tree."
treeView := CwTreeView
createWidget: 'TreeView'
parent: shell
argBlock: nil.
treeView manageChild.
"Create icons to be used in the nodes of the tree."
images := (CgIcon
fromResources: #(107 106)
fileName: 'cgwtres.dll').
icon := images at: 1.
selectedIcon := images at: 2.
"Create a root mother node with two daughters."
motherNode := treeView
createTreeNode: 'Mother'
argBlock: [:w | w
labelString: 'Mother';
image: icon;
selectedImage: selectedIcon].
treeView
createTreeNode: 'Daughter1'
argBlock: [:w | w
labelString: 'Daughter1';
image: icon;
selectedImage: selectedIcon;
parentNode: motherNode].
treeView
createTreeNode: 'Daughter2'
argBlock: [:w | w
labelString: 'Daughter2';
image: icon;
selectedImage: selectedIcon;
parentNode: motherNode].
Last modified date: 04/21/2022