
TreeViewCustomNode is a class to make custom rendered TreeView nodes and possibly with custom functionality.
Note: This class is only available when running on REALbasic 2007r3 and later.
TreeViewCustomNode inherits all properties and methods from TreeViewNode. See the documentation for
TreeViewNode to get further documentation.
Note:You can inherit from the TreeViewCustomNode and add your own data properties to it. In fact the way to make your custom rendered node is to inherit from the TreeViewCustomNode class and hook your custom code into its events.
Warning:A TreeViewCustomNode can not be reused in any way. This means that a node may not be put in two different TreeView controls or twice in the same unless if the node has first been removed from the TreeView that it was in.
TreeViewNode
TreeViewCustomNode
class TreeViewCustomNode
Constructors
Properties
FontBold (Inherited) | Set this property to true to let the node text be drawn bold faced. |
FontItalic (Inherited) | Set this property to true to let the node text be drawn italic faced. |
FontUnderline (Inherited) | Set this property to true to let the node text be drawn with text underline style. |
HasExpander (Inherited) | Use this property to force a node to have a expander even if it has no child nodes. |
Image (Inherited) | Sets or gets the node image. |
ItemData (Inherited) | A property to store custom data on the node. |
Text (Inherited) | Sets or gets the text of a node. |
TextColor (Inherited) | Sets the text color of a node. |
Methods
AddSubItem (Inherited) | Adds text to additional columns of the node. |
AppendNode (Inherited) | Appends a child node to the current node. |
Depth (Inherited) | Returns the depth of the node in the tree. |
Expanded (Inherited) | Returns true if the node is expanded. |
Index (Inherited) | Returns the Screen Index of the node. |
ItemText (Inherited) | Sets or gets the text for a specific column. |
Node (Inherited) | Returns a child node at a given index. |
NodeCount (Inherited) | Returns the count of child nodes. |
RemoveChild (Inherited) | Removes a child node. |
RemoveChildAt (Inherited) | Removes a child node at a index that is relative to the parent node. |
Selected (Inherited) | Returns true if the node is currently selected. |
SetExpanded (Inherited) | Expands or collapses the node. |
Swap (Inherited) | Swaps child nodes of the given node instance. |
Events
DrawBackground | Draws the background of a node. |
DrawForeground | Draws the foreground of a node. |
MouseDown | This Event is fired when mouse goes down in the custom node. |
MouseDrag | This Event is fired when mouse is dragged over the custom node after mouse has gone down there and true was returned from the mouse down event. |
MouseUp | This Event is fired when mouse buttons goes up in the custom node after mouse has gone down there and true was returned from the mouse down event. |
Example
Sub DrawForeground(g as Graphics,ByRef textYOffset as Integer, offset as Integer,owner as TreeView)
Dim img as Picture
Dim img2 as Picture
if State = 0 then
img = SuccessImage
else
img = FailImage
end if
if IsDown then
img2 = NewPicture(img.Width,img.Height,32)
img2.Graphics.DrawPicture(img,0,0)
img2.Mask.Graphics.DrawPicture(SuccessMaskImageFaded,0,0)
g.DrawPicture img2,g.Width - 18,1
else
g.DrawPicture img,g.Width - 18,1
end if
ButtonStart = g.Width - 18
End Sub
Function MouseDown(x as Integer,y as Integer,owner as TreeView) As Boolean
if x > ButtonStart and x < ButtonStart + 15 and y > 2 and y < 18 then
IsDown = true
return true
end if
return false
End Function
Function MouseDrag(x as Integer,y as Integer,owner as TreeView) As Boolean
if x > ButtonStart and x < ButtonStart + 15 and y > 2 and y < 18 and IsDown = false then
IsDown = true
return true
elseif not (x > ButtonStart and x < ButtonStart + 15 and y > 2 and y < 18) and IsDown = true then
IsDown = false
return true
end if
return false
End Function
Function MouseUp(x as Integer,y as Integer,ByRef triggerAction as Boolean,owner as TreeView) As Boolean
IsDown = false
if x > ButtonStart and x < ButtonStart + 15 and y > 2 and y < 18 then
triggerAction = true
if State = 0 then
State = 1
else
State = 0
end if
end if
return true
End Function
Supported Platforms:
PPC - MacOS 9Carbon - MacOS 9 and MacOS X (PEF)MacOS X PPC - (Mach-O)MacOS X Universal Binary (Mach-O)Win32 - WindowsLinux x86