class treeView

superclass(es) customControl
subclass(es) -
description This class is a control window that can display hierarchical information in a tree.

pl_img123.gif (3120 bytes)
see also panel

tasks

A treeView is a control that contains a collection of treenodes. Each node inside the tree has four important properties, the text that is visible, the images that can be displayed for a treenode, an internal integer identification value and an internal text string. Each node can have two separate images, a 'close' and an 'open' image. The 'close' image is used if the children of a treenode are not visible, the 'open' image is used if the children are visible.

Inside the tree control there is (usually) a current node, most operations that manipulate the tree work relative to the current node. Adding nodes with append/3, append/5, append/7, appendSibling/3, appendSibling/5 and appendSibling/7 is done relative to the current node. Changing the current node can be done with findCurrentId/2, findCurrentText/2 and findCurrentExtraText/2 and many more methods. The following methods are also useful for navigating through treenodes: toParent/1, toChild/1, prevSiblingNode/1, nextSiblingNode/1, makeFirstNodeCurrent/3, makeLastNodeCurrent/3, moveCurrentUp/4 and moveCurrentDown/4. To remove nodes from the tree control there are the methods: removeCurrent/1, removeNodeId/2, removeNodeText/2, removeNodeExtraText/2, removeAll/0 and removeAllSelected/0.

How the tree control draws itself can be configured by methods like putShowLines/1, putShowPlusMinusImages/1, putShowDefaultImage/1, putShow3DBorder/1, putAllowMultipleSelect/1, putPlusImage/1, putMinusImage/1, putExtraPlusMinusImages/3, putLevelOffset/1 and putLineHeight/1.

Two types of drag & drop are supported by the treeView control, it can accept filenames that are dragged from the Windows to the control, for this see the methods putDragAcceptFiles/1 and dragAcceptFiles/1. It is also possible to drag & drop treenodes inside a control and between different tree controls, for this see the methods enableDragDrop/1 and dragDropEnabled/1.

There is an example that demonstrates the tree control, it is called treeView, more information about examples.

methods

putShowLines( YesNo )

func Determine if the lines between parent and child nodes are drawn or not.
pre The variable YesNo must contain either 'true' or 'false'.
post If YesNo was 'true' then lines between nodes are drawn else not.

showLines( Result )

func Check if lines between parent and child nodes are drawn or not.
pre TRUE
post If lines between nodes are drawn then Result will be unified with 'true', else with 'false'.

putShowPlusMinusimages( YesNo )

func Determine if the pl_img124.gif (1609 bytes) and pl_img125.gif (1605 bytes) images are drawn for nodes with have children.
pre The variable YesNo must contain either 'true' or 'false'.
post If YesNo was 'true' then the images are drawn else not.

showPlusMinusimages( Result )

func Check if the pl_img124.gif (1609 bytes) and pl_img125.gif (1605 bytes) images are drawn for nodes with have children.
pre TRUE
post If the pl_img124.gif (1609 bytes) and pl_img125.gif (1605 bytes) images are drawn then Result will be unified with 'true', else with 'false'.

putShowDefaultImage( YesNo )

func Determine if an image is drawn for nodes which have no children. There is no default image for these nodes. Use the method putDefaultImage/1 to tell the control which image to use.
pre The variable YesNo must contain either 'true' or 'false'.
post If YesNo was 'true' then an image is drawn for nodes with have no child nodes, else not.
arrow.gif (1632 bytes) use putDefaultImage/1

showDefaultImage( Result )

func Check if the an image is drawn for nodes which have no child nodes.
pre TRUE
post If an image is drawn for nodes with no child nodes then Result will be unified with 'true', else with 'false'.

putShowBorder( YesNo )

func Determine if a border is drawn by the tree control.
pre The variable YesNo must contain either 'true' or 'false'.
post If YesNo was 'true' then a border is drawn, else not.

showBorder( Result )

func Check if the border is drawn by the tree control.
pre TRUE
post If a border is drawn by the tree control then Result will be unified with 'true', else with 'false'.

putAllowMultipleSelect( YesNo )

func Determine if the user may select more than one treenode. Default is that the user may not select more than one node.
pre The variable YesNo must contain either 'true' or 'false'.
post If YesNo was 'true' then it is possible to select more than one node, else not.

allowedMultipleSelect( Result )

func Check if the user may select more than one treenode or not.
pre TRUE
post If it is possible to select more than one treenode then Result will be unified with 'true', else with 'false'.

putPlusImage( Img )

func Set the image instance to use for treenodes with children and which are not visible yet. The default plus image is pl_img124.gif (1609 bytes).
pre The Img parameter must refer to an instance of the image class.
post The image instance for tree branches, with children that are not visible, will be the same as parameter Img.

plusImage( Result )

func Get the image instance used for treenodes with children and which are not visible yet. The default plus image is pl_img124.gif (1609 bytes).
pre TRUE
post The image instance for tree branches, with children that are not visible, was unified with Result. The Result variable will remain empty if there is no 'plus' image.

putMinusImage( Img )

func Set the image instance to use for treenodes with children and which visible. The default plus image is pl_img125.gif (1605 bytes).
pre The Img parameter must refer to an instance of the image class.
post The image instance for tree branches, with children that are visible, will be the same as parameter Img.

minusImage( Result )

func Get the image instance used for treenodes with children and which are already visible. The default minus image is pl_img125.gif (1605 bytes).
pre TRUE
post The image instance for tree branches, with children that are visible, that are open was unified with Result. The Result variable will remain empty if there is no 'minus' image.

putDefaultImage( Img )

func Set the image instance to use for treenodes with no children.
pre The Img parameter must refer to an instance of the image class.
post The image instance for treenodes with no children, will be the same as parameter Img.

defaultImage( Result )

func Get the image instance used for treenodes with no children.
pre TRUE
post The image instance for treenodes with no children was unified with Result. The Result variable will remain empty if there is no 'default' image.

putExtraPlusMinusImages( YesNo, ImgPlus, ImgMinus )

func Determine if extra images are shown and set the extra image instances for treenodes with children. The extra image is drawn to the right of the pl_img125.gif (1605 bytes) or pl_img124.gif (1609 bytes) image. If the YesNo parameter is false no extra images are shown.
pre The variable YesNo must contain either 'true' or 'false'. The ImgPlus and ImgMinus parameters must refer to an instance of the image class.
post If YesNo was true then extra images are shown else not, The extra image instances for tree branches with children will be assigned to the values of ImgPlus and ImgMinus.

areExtraPlusMinusimagesShown( Result )

func Check if extra images are shown for nodes with children.
pre TRUE
post If extra images are shown then Result will be unified with true else with false.

putExtraPlusImage( Img )

func Set the extra image instance to use for treenodes with children and which are not visible yet. The extra image is drawn to the right of the pl_img124.gif (1609 bytes) image.
pre The Img parameter must refer to an instance of the image class.
post The extra image instance for tree branches, with children that are not visible, will be the same as parameter Img.
arrow.gif (1632 bytes) see the method putExtraPlusMinusImages/3

extraPlusImage( Result )

func Get the extra image instance used for treenodes with children and which are not visible yet.
pre TRUE
post The extra image instance for tree branches, with children, that may be opened was unified with Result. The Result variable will remain empty if there is no extra 'plus' image.

putExtraMinusImage( Img )

func Set the extra image instance to use for treenodes with children and which visible. The extra image is drawn to the right of the pl_img125.gif (1605 bytes) image.
pre The Img parameter must refer to an instance of the image class.
post The extra image instance for tree branches, with children that are visible, will be the same as parameter Img.
arrow.gif (1632 bytes) see the method putExtraPlusMinusImages/3

extraMinusImage( Result )

func Get the extra image instance used for treenodes with children and which are already visible.
pre TRUE
post The extra image instance for tree branches, with children that are visible, was unified with Result. The Result variable will remain empty if there is no extra 'minus' image.

loadDefaultImages( Result )

func Have the control load the default images for treenodes with children. The default images are pl_img125.gif (1605 bytes) and pl_img124.gif (1609 bytes).
pre TRUE
post If the default images were sucessfully loaded then was true unified with Result, else false.

pointToNode( point(X, Y), ResultId, ExpandCollapseImage )

func Translate a point coordinate to a treenode and also check if the point is in the rectangle occupied by any of the plus or minus images, the default plus and minus images are pl_img125.gif (1605 bytes) and pl_img124.gif (1609 bytes).
pre The parameters X and Y must contain an integer value.
post If the coordinate specified by the point (X, Y) is occupied by a treenode then the identification value of that node will be unified with the parameter ResultId, if the point (X, Y) is inside the plus or minus image rectangle, of that same node, then true will be unified with the parameter ExpandCollapseImage, else false.

putLevelOffset( Val )

func Set the number of pixels that will separate each level of treenodes, i.e. the number of pixels between a parent and a child treenode.
pre The Val parameter must be an integer.
post The value of the parameter Val will be used as the number of pixels between a parent and a child treenode.

levelOffset( Result )

func Get the number of pixels that separates each level of treenodes, i.e. the number of pixels between a parent and a child treenode.
pre TRUE
post The number of pixels between a parent and a child treenode will be unified with the parameter Result.

putLineHeight( Val )

func Set the height for each line in the control, the height is specified in pixels.
pre The Val parameter must be an integer.
post The value of the parameter Val will be used as the height of each line.

lineHeight( Val )

func Get the height for each line in the control, the height is specified in pixels.
pre TRUE
post The value for the height of each line was unified with the parameter Val.

putMinimalImageWidth( YesNo, Val )

func Determine if there must be a minimum number of pixels for each image of a treenode. The YesNo parameter determines if there is such a minimum and the second parameter the width of the area in pixels.
pre The YesNo parameter must contain either true or false and the Val parameter must be an integer.
post The value of the parameter Val will be used as the minimum width for an image if YesNo was true, else if YesNo was false then no minimum image width will be used.

isMinimalImageWidthOn( Result )

func Check if if there is a minimum number of pixels for each image of a treenode.
pre TRUE
post If there is minimum width for each image then Result will be unified with true, else with the value false.

minimalImageWidth( Result )

func Get the minimum number of pixels for each image of a treenode.
pre TRUE
post The minimum width for each image will be unified with the parameter Result.

firstRootId( Result )

func Get the, user assigned, identification value for the first treenode that has no parent node.
pre TRUE
post If there is no first root node then no value will be unified with Result, else the user assigned identification value will be unified with the parameter Result.

firstRootText( Result )

func Get the text of the first treenode that has no parent node.
pre TRUE
post If there is no first root node then no value will be unified with Result, else the text of the treenode will be unified with the parameter Result.

firstRootExtraText( Result )

func Get the extra text of the first treenode that has no parent node. The extra text of a treenode is never shown and can be used as an extra field to store application attributes.
pre TRUE
post If there is no first root node then no value will be unified with Result, else the extra text attribute of the treenode will be unified with the parameter Result.

current( Id, Text, ExtraText )

func Get the identification value, visible text and the extra text of the current treenode.
pre TRUE
post If there is no current node then no value will be unified with the output parameters, else the id, text and extratext values will have been unified with the three output parameters.

currentId( Result )

func Get the, user assigned, identification value for the current treenode.
pre TRUE
post If there is no current node then no value will be unified with Result, else the user assigned identification value will be unified with the parameter Result.

currentText( Result )

func Get the text of the current treenode that has no parent node.
pre TRUE
post If there is no current node then no value will be unified with Result, else the text of the treenode will be unified with the parameter Result.

currentExtraText( Result )

func Get the extra text of the current treenode that has no parent node. The extra text of a treenode is never shown and can be used as an extra field to store application attributes.
pre TRUE
post If there is no current node then no value will be unified with Result, else the extra text attribute of the treenode will be unified with the parameter Result.

findCurrentId( Id, Result )

func Search for a treenode with the same, user assigned, identification value as the parameter Id.
pre The parameter Id must contain an integer value.
post If a treenode was found with the same identification value then it has become the current treenode and Result will be unified with the value true. If no treenode was found then Result will be unified with false.
arrow.gif (1632 bytes) see also: findCurrentId/3

findCurrentText( Str, Result )

func Search for a treenode with the same text value as the parameter Str.
pre The parameter Str must contain an atomic value.
post If a treenode was found with the same text then it has become the current treenode and Result will be unified with the value true. If no treenode was found then Result will be unified with false.
arrow.gif (1632 bytes) see also: findCurrentText/3

findCurrentExtraText( Str, Result )

func Search for a treenode with the same extra text attribute value as the parameter Str. The extra text of a treenode is never shown and can be used as an extra field to store application attributes.
pre The parameter Str must contain an atomic  value.
post If a treenode was found with the same extra text attribute then it will has become the current treenode and Result will be unified with the value true. If no treenode was found then Result will be unified with false.
arrow.gif (1632 bytes) see also: findCurrentExtraText/3

findCurrentId( Id, ExecuteEvent, Result )

func Search for a treenode with the same, user assigned, identification value as the parameter Id. If the value of the second parameter, ExecuteEvent, is true then the event onSelectNode/4 is executed, else not.
pre The parameter Id must contain an integer value and the value of ExecuteEvent must be boolean.
post If a treenode was found with the same identification value then it has become the current treenode and Result will be unified with the value true. If no treenode was found then Result will be unified with false.
arrow.gif (1632 bytes) see also: findCurrentId/2

findCurrentText( Str, ExecuteEvent, Result )

func Search for a treenode with the same text value as the parameter Str. If the value of the second parameter, ExecuteEvent, is true then the event onSelectNode/4 is executed, else not.
pre The parameter Str must contain an atomic value and the value of ExecuteEvent must be boolean.
post If a treenode was found with the same text then it has become the current treenode and Result will be unified with the value true. If no treenode was found then Result will be unified with false.
arrow.gif (1632 bytes) see also: findCurrentText/2

findCurrentExtraText( Str, ExecuteEvent, Result )

func Search for a treenode with the same extra text attribute value as the parameter Str. The extra text of a treenode is never shown and can be used as an extra field to store application attributes. If the value of the second parameter, ExecuteEvent, is true then the event onSelectNode/4 is executed, else not.
pre The parameter Str must contain an atomic value and the value of ExecuteEvent must be boolean.
post If a treenode was found with the same extra text attribute then it will has become the current treenode and Result will be unified with the value true. If no treenode was found then Result will be unified with false.
arrow.gif (1632 bytes) see also: findCurrentExtraText/2

contains( Result )

func Count the number of treenodes in the control.
pre TRUE
post The integer value of the number of nodes in the tree control is unified with the value of the parameter Result.

toParent( Result )

func Make the parent node of the current treenode the new current node of the control.
pre TRUE
post If the parent of the current treenode has become the new current treenode then the value true is unified with the parameter Result, else is false unified with Result.

toChild( Result )

func Make the first child node of the current treenode the new current node of the control.
pre TRUE
post If the first child node of the current treenode has become the new current treenode then the value true is unified with the parameter Result, else is false unified with Result.

prevSiblingNode( Result )

func Make the previous sibling node of the current treenode the new current node of the control. The previous sibling node is the previous node with the same parent (i.e. a brother/sister of a node).
pre TRUE
post If the previous sibling node of the current treenode has become the new current treenode then the value true is unified with the parameter Result, else is false unified with Result.

nextSiblingNode( Result )

func Make the next sibling node of the current treenode the new current node of the control. The next sibling node is the next node with the same parent (i.e. a brother/sister of a node).
pre TRUE
post If the next sibling node of the current treenode has become the new current treenode then the value true is unified with the parameter Result, else is false unified with Result.

visiblePositionOfCurrentNode( Result )

func Determine the visible position of the current treenode. The first node that can be displayed (it may be scrolled out of view) is position 0, the next node position 1, etc. A visible position of 5 means that the current node is the 6-th node that will be drawn by the control.
pre TRUE
post If there is a current node then its visible position number is unified with the parameter Result, else if there is no current node then no value is unified with Result.

visiblePositionOfNode( Id, Result )

func Determine the visible position of the treenode with the same identification value as the parameter Id. The first node that can be displayed (it may be scrolled out of view) is position 0, the next node position 1, etc. A visible position of 5 means that the current node is the 6-th node that will be drawn by the control.
pre The parameter Id must contain an integer value.
post If there is a node with the same identification value then its visible position number is unified with the parameter Result, else if there is no current node then no value is unified with Result.

firstVisible( Result )

func Determine the identification value of the first visible treenode, this is the first node of the control that may be displayed, it may be scrolled out of view
pre TRUE
post If the control is not empty then the identification value of the first visible node is unified with the parameter Result, else no value is unified with Result.

prevVisible( Id, Result )

func Determine the identification value of the previous visible treenode of the node with the same identification value as the parameter Id.
pre The parameter Id must contain an integer value.
post The identification value of the previous visible node is unified with the parameter Result, else if there is no previous visible node then no value is unified with Result.

nextVisible( Id, Result )

func Determine the identification value of the next visible treenode of the node with the same identification value as the parameter Id.
pre The parameter Id must contain an integer value.
post The identification value of the next visible node is unified with the parameter Result, else if there is no next visible node then no value is unified with Result.

isNodeVisible( Id, Result )

func Check if the treenode, with the same identification value as the parameter Id, is visible to the user. The treenode may be scrolled out of view.
pre The parameter Id must contain an integer value.
post If a node is visible then the parameter Result is unified with true, else with false.

makeNodeVisible( Id, Result )

func The treenode, with the same identification value as the parameter Id, must become visible to the user.
pre The parameter Id must contain an integer value.
post If the node has become visible then the parameter Result is unified with true, else with false.

isNodeInsideClientArea( Id, Result )

func Check if the treenode, with the same identification value as the parameter Id, is visible to the user. The method checks of the node is inside the rectangulare area of the control that is visible to the user.
pre The parameter Id must contain an integer value.
post If a node is visible (not scrolled out of view) then the parameter Result is unified with true, else with false.

adaptVScrollToMakeCurrentVisible

func Adapt the vertical scrollbar so that the current node becomes visible.
pre TRUE
post The current treenode is inside visible area of the tree control.

adaptVScrollToMakeNodeVisible( Id )

func Adapt the vertical scrollbar so that the node identified by the value 'Id' becomes visible.
pre The parameter Id must contain an integer value.
post The treenode is inside visible area of the tree control.

nodeRectangle( Id, rectangle(L, T, R, B) )

func Get the rectangular area last occupied by the node, with the same identification value as parameter Id, when it was drawn.
pre The parameter Id must contain an integer value.
post The four coordinates of the rectangular area (Left, Top, Right,Bottom) were unified with the second parameter.

append( Text, Id, Result )

func Add a new treenode to the control. The new node will become the last child node of the current node, if the control is empty then it will become the first root node. The value of the Text parameter will be displayed as the text of the treenode and the Id value can be used to uniquely identify each node. The new node will become the new current node of the tree control.
pre The parameter Text must contain an atomic value and the parameter Id must contain an integer value.
post If a node was successfully created then the parameter Result is unified with true, else with false.

append( Text, Id, MakeCurrent, ExtraString, Result )

func Add a new treenode to the control. The new node will become the last child node of the current node, if the control is empty then it will become the first root node. The value of the Text parameter will be displayed as the text of the treenode and the Id value can be used to uniquely identify each node. The new node will become the new current node of the tree control if the value of the MakeCurrent parameter is true, else not. The ExtraString parameter can be used by an application to store 'internal' data per node, the value of that parameter is never shown.
pre The parameters Text and ExtraString must contain an atomic value, the parameter Id must contain an integer value and MakeCurrent must contain either true or false.
post If a node was successfully created then the parameter Result is unified with true, else with false.

append( Text, Id, MakeCurrent, ExtraString, Image, OpenImage, Result )

func Add a new treenode to the control. The new node will become the last child node of the current node, if the control is empty then it will become the first root node. The value of the Text parameter will be displayed as the text of the treenode and the Id value can be used to uniquely identify each node. The new node will become the new current node of the tree control if the value of the MakeCurrent parameter is true, else not. The ExtraString parameter can be used by an application to store 'internal' data per node, the value of that parameter is never shown.

With the last two input parameters (Image and OpenImage) is it possible to specify which images will be displayed for the treenode if it has child nodes. The value of the first Image parameter is used if the children of the node are not visible.

pre The parameters Text and ExtraString must contain an atomic value, the parameter Id must contain an integer value and MakeCurrent must contain either true or false. The two image parameters must refer to an instance of the image class.
post If a node was successfully created then the parameter Result is unified with true, else with false.

appendChild( ParentId, Text, Id, Result )

func Add a new treenode to the control. The new node will become the last child of the node identified by the value of ParentId. The value of the Text parameter will be displayed as the text of the treenode and the Id value can be used to uniquely identify each node.
pre The parameter Text must contain an atomic value and the parameters ParentId and Id must contain an integer value.
post If a node was successfully created then the parameter Result is unified with true, else with false.

appendChild( ParentId, Text, Id, MakeCurrent, ExtraString, Result )

func Add a new treenode to the control. The new node will become the last child of the node identified by the value of ParentId. The value of the Text parameter will be displayed as the text of the treenode and the Id value can be used to uniquely identify each node. The new node will become the new current node of the tree control if the value of the MakeCurrent parameter is true, else not. The ExtraString parameter can be used by an application to store 'internal' data per node, the value of that parameter is never shown.
pre The parameters Text and ExtraString must contain an atomic value, the parameters ParentId and Id must contain an integer value and MakeCurrent must contain either true or false.
post If a node was successfully created then the parameter Result is unified with true, else with false.

appendChild( ParentId, Text, Id, MakeCurrent, ExtraString, Image, OpenImage, Result )

func Add a new treenode to the control. The new node will become the last child of the node identified by the value of ParentId. The value of the Text parameter will be displayed as the text of the treenode and the Id value can be used to uniquely identify each node. The new node will become the new current node of the tree control if the value of the MakeCurrent parameter is true, else not. The ExtraString parameter can be used by an application to store 'internal' data per node, the value of that parameter is never shown.

With the last two input parameters (Image and OpenImage) is it possible to specify which images will be displayed for the treenode if it has child nodes. The value of the first Image parameter is used if the children of the node are not visible.

pre The parameters Text and ExtraString must contain an atomic value, the parameters ParentId and Id must contain an integer value and MakeCurrent must contain either true or false. The two image parameters must refer to an instance of the image class.
post If a node was successfully created then the parameter Result is unified with true, else with false.

appendSibling( Text, Id, Result )

func Add a new treenode to the control. The new node will become the last sibling of the current node, if the control is empty then it will become the first root node. The value of the Text parameter will be displayed as the text of the treenode and the Id value can be used to uniquely identify each node.
pre The parameter Text must contain an atomic value and the parameter Id must contain an integer value.
post If a node was successfully created then the parameter Result is unified with true, else with false.

appendSibling( Text, Id, MakeCurrent, ExtraString, Result )

func Add a new treenode to the control. The new node will become the last sibling of the current node, if the control is empty then it will become the first root node. The value of the Text parameter will be displayed as the text of the treenode and the Id value can be used to uniquely identify each node. The new node will become the new current node of the tree control if the value of the MakeCurrent parameter is true, else not. The ExtraString parameter can be used by an application to store 'internal' data per node, the value of that parameter is never shown.
pre The parameters Text and ExtraString must contain an atomic value, the parameter Id must contain an integer value and MakeCurrent must contain either true or false.
post If a node was successfully created then the parameter Result is unified with true, else with false.

appendSibling( Text, Id, MakeCurrent, ExtraString, Image, OpenImage, Result )

func Add a new treenode to the control. The new node will become the last sibling of the current node, if the control is empty then it will become the first root node. The value of the Text parameter will be displayed as the text of the treenode and the Id value can be used to uniquely identify each node. The new node will become the new current node of the tree control if the value of the MakeCurrent parameter is true, else not. The ExtraString parameter can be used by an application to store 'internal' data per node, the value of that parameter is never shown.

With the last two input parameters (Image and OpenImage) is it possible to specify which images will be displayed for the treenode if it has child nodes. The value of the first Image parameter is used if the children of the node are not visible.

pre The parameters Text and ExtraString must contain an atomic value, the parameter Id must contain an integer value and MakeCurrent must contain either true or false. The two image parameters must refer to an instance of the image class.
post If a node was successfully created then the parameter Result is unified with true, else with false.

insertBefore( BeforeId, Text, Id, Result )

func Insert a new treenode in front of the treenode identified by the value of the parameter BeforeId. The value of the Text parameter will be displayed as the text of the treenode and the Id value can be used to uniquely identify each node.
pre The parameter Text must contain an atomic value and the parameters BeforeId and Id must contain an integer value.
post If a node was successfully created then the parameter Result is unified with true, else with false.

insertBefore( BeforeId, Text, Id, MakeCurrent, ExtraString, Result )

func Insert a new treenode in front of the treenode identified by the value of the parameter BeforeId. The value of the Text parameter will be displayed as the text of the treenode and the Id value can be used to uniquely identify each node. The new node will become the new current node of the tree control if the value of the MakeCurrent parameter is true, else not. The ExtraString parameter can be used by an application to store 'internal' data per node, the value of that parameter is never shown.
pre The parameters Text and ExtraString must contain an atomic value, the parameters BeforeId and Id must contain an integer value and MakeCurrent must contain either true or false.
post If a node was successfully created then the parameter Result is unified with true, else with false.

insertBefore( BeforeId, Text, Id, MakeCurrent, ExtraString, Image, OpenImage, Result )

func Insert a new treenode in front of the treenode identified by the value of the parameter BeforeId. The value of the Text parameter will be displayed as the text of the treenode and the Id value can be used to uniquely identify each node. The new node will become the new current node of the tree control if the value of the MakeCurrent parameter is true, else not. The ExtraString parameter can be used by an application to store 'internal' data per node, the value of that parameter is never shown.

With the last two input parameters (Image and OpenImage) is it possible to specify which images will be displayed for the treenode if it has child nodes. The value of the first Image parameter is used if the children of the node are not visible.

pre The parameters Text and ExtraString must contain an atomic value, the parameters BeforeId and Id must contain an integer value and MakeCurrent must contain either true or false. The two image parameters must refer to an instance of the image class.
post If a node was successfully created then the parameter Result is unified with true, else with false.

insertBeforeCurrent( Text, Id, Result )

func Insert a new treenode in front of the current treenode. The value of the Text parameter will be displayed as the text of the treenode and the Id value can be used to uniquely identify each node.
pre The parameter Text must contain an atomic value and the parameters BeforeId and Id must contain an integer value.
post If a node was successfully created then the parameter Result is unified with true, else with false.

insertBeforeCurrent( Text, Id, MakeCurrent, ExtraString, Result )

func Insert a new treenode in front of the current treenode. The value of the Text parameter will be displayed as the text of the treenode and the Id value can be used to uniquely identify each node. The new node will become the new current node of the tree control if the value of the MakeCurrent parameter is true, else not. The ExtraString parameter can be used by an application to store 'internal' data per node, the value of that parameter is never shown.
pre The parameters Text and ExtraString must contain an atomic value, the parameters BeforeId and Id must contain an integer value and MakeCurrent must contain either true or false.
post If a node was successfully created then the parameter Result is unified with true, else with false.

insertBeforeCurrent( Text, Id, MakeCurrent, ExtraString, Image, OpenImage, Result )

func Insert a new treenode in front of the current treenode. The value of the Text parameter will be displayed as the text of the treenode and the Id value can be used to uniquely identify each node. The new node will become the new current node of the tree control if the value of the MakeCurrent parameter is true, else not. The ExtraString parameter can be used by an application to store 'internal' data per node, the value of that parameter is never shown.

With the last two input parameters (Image and OpenImage) is it possible to specify which images will be displayed for the treenode if it has child nodes. The value of the first Image parameter is used if the children of the node are not visible.

pre The parameters Text and ExtraString must contain an atomic value, the parameters BeforeId and Id must contain an integer value and MakeCurrent must contain either true or false. The two image parameters must refer to an instance of the image class.
post If a node was successfully created then the parameter Result is unified with true, else with false.

removeCurrent( Result )

func Remove the current treenode from the control.
pre TRUE
post If a node was successfully removed then the parameter Result is unified with true, else with false.

removeNodeId( Id, Result )

func Remove the treenode, with the same identification value as the parameter Id, from the control.
pre The parameter Id must contain an integer value.
post If a node was successfully removed then the parameter Result is unified with true, else with false.

removeNodeText( Text, Result )

func Remove the treenode, with the same text value as the parameter Text, from the control.
pre The parameter Text must contain an atomic value.
post If a node was successfully removed then the parameter Result is unified with true, else with false.

removeNodeExtraText( Text, Result )

func Remove the treenode, with the same extra text value as the parameter Text, from the control.
pre The parameter Text must contain an atomic value.
post If a node was successfully removed then the parameter Result is unified with true, else with false.

removeAll

func Remove all the treenodes from the control.
pre TRUE
post The tree control is empty.

removeAllSelected

func Remove all the treenodes from the control that have been selected.
pre TRUE
post All treenodes that were selected have been removed from the tree control.

putCurrentId( NewId, Result )

func Change the identifier value of the current treenode.
pre The parameter NewId must contain an integer value.
post If the identifier of the current treenode was changed then the value true was unified with the parameter Result, if there was no current treenode then was false unified with Result.

putCurrentText( NewStr, Result )

func Change the visible text of the current treenode.
pre The parameter NewStr must contain an atomic value.
post If the text of the current treenode was successfully changed then the value true was unified with the parameter Result, if there was no current treenode then was false unified with Result.

putCurrentExtraText( NewStr, Result )

func Change the extra text of the current treenode. Normally this text is not visible.
pre The parameter NewStr must contain an atomic value.
post If the extra text property of the current treenode was successfully changed then the value true was unified with the parameter Result, if there was no current treenode then was false unified with Result.

putCurrentImages( Image, OpenImage, Result )

func Change one or both images that can be associated with the current treenode. The first image is displayed if the children of the node are not visible, the second image is displayed if the children of the current node are visible.
pre The parameters Image and OpenImage must refer to an instance of the image class (or 0).
post If the images of the current treenode were successfully changed then the value true was unified with the parameter Result, else was false unified with Result.

putNodeId(Id, NewId, Result)

func Change the identifier value of the treenode with the same identification value as Id. The value of Id will be replaced by the value of the parameter NewId
pre The parameters Id and NewId must have integer values.
post If the identifier of a treenode was changed then the value true was unified with the parameter Result, if there was no current treenode then false was unified with Result.

putNodeText( Id, Str, Result )

func Change the visible text of the treenode with the same identifier as the value of the parameter Id.
pre The parameter Id must contain an integer value and the parameter Str must contain an atomic value.
post If the text of a treenode was successfully changed then the value true was unified with the parameter Result, if there was no current treenode then false was unified with Result.

putNodeExtraText( Id, Str, Result )

func Change the extra text of the treenode with the same identifier as the value of the parameter Id. Normally this text is not visible.
pre The parameter Id must contain an integer value and the parameter Str must contain an atomic value.
post If the extra text property of a treenode was successfully changed then the value true was unified with the parameter Result, if there was no current treenode then false was unified with Result.

putNodeImages( Id, Image, OpenImage, Result )

func Change one or both images that can be associated with a treenode. Which node is determined by the value of the Id parameter. The first image is displayed if the children of the treenode are not visible, the second image is displayed if the children of the treenode are visible.
pre The parameter Id must contain an integer value  and the parameters Image and OpenImage must refer to an instance of the image class (or 0).
post If the images of the treenode were successfully changed then the value true was unified with the parameter Result, else was false unified with Result.

toggleNode( Redraw, Result )

func Toggle the current treenode, if it the child nodes are not visible then they become visible and vice versa. The control is redrawn if the value of the Redraw parameter is true.
pre The parameter Redraw must contain either true or false.
post If the current node was successfully toggled then the parameter Result is unified with true, else with false.

toggleNode( Id, Redraw, Result )

func Toggle the treenode, with the same identification value as the parameter Id, if it the child nodes are not visible then they become visible and vice versa. The control is redrawn if the value of the Redraw parameter is true.
pre The parameter Id must contain an integer value and the parameter Redraw must contain either true or false.
post If a node was successfully toggled then the parameter Result is unified with true, else with false.

isExpanded( Id, Result )

func Determine if the node, with the same identification value as the value of the parameter Id, is expanded, i.e. are the child nodes that it has visible?
pre The parameter Id must contain an integer value.
post If the child nodes are visible then the parameter Result is unified with true, else with false.

isCollapsed( Id, Result )

func Determine if the node, with the same identification value as the value of the parameter Id, is collapsed, i.e. are the child nodes that it has not visible?
pre The parameter Id must contain an integer value.
post If the child nodes are not visible then the parameter Result is unified with true, else with false.

expandAll

func Expand all brances of the entire tree in the tree control, all child nodes will become visible.
pre TRUE
post AlI the (child) nodes are visible.

collapseAll

func Collapse all brances of the entire tree in the tree control, no child nodes will be shown.
pre TRUE
post None of the child nodes in the tree control are visible.

makeFirstNodeCurrent( Redraw, Multi, Result )

func Make the first node of the tree control the new current node and select the node. If the value of the parameter Multi is true then all nodes between the 'old' current and the first node are selected.
pre The parameters Redraw and Multi must contain either true or false.
post If the first node was successfully selected then the parameter Result is unified with true, else with false.

makeLastNodeCurrent( Redraw, Multi, Result )

func Make the last node of the tree control the new current node and select the node. If the value of the parameter Multi is true then all nodes between the 'old' current and the last node are selected.
pre The parameters Redraw and Multi must contain either true or false.
post If the last node was successfully selected then the parameter Result is unified with true, else with false.

moveCurrentUp( Visible, Redraw, Multi, Result )

func Make the previous of the 'old' current node of the tree control the new current node and select that node. If Visible is true the new current will be inside the area visible to the user (inside the client rectangle). If the value of the parameter Multi is true then both the 'old' current and the new current are selected.
pre The parameters Visible, Redraw and Multi must contain either true or false.
post If the previous node of the 'old' current was successfully selected then the parameter Result is unified with true, else with false.

moveCurrentDown( Visible, Redraw, Multi, Result )

func Make the next node of the 'old' current node of the tree control the new current node and select that node. If Visible is true the new current will be inside the area visible to the user (inside the client rectangle). If the value of the parameter Multi is true then both the 'old' current and the new current are selected.
pre The parameters Visible, Redraw and Multi must contain either true or false.
post If the next node of the 'old' current was successfully selected then the parameter Result is unified with true, else with false.

removeSelection

func Remove any selection, including a multiple selection.
pre TRUE
post No nodes will be selected in the tree control.

removeMultipleSelection

func Remove a selection if it is a multiple selection.
pre TRUE
post There will be no multiple selection in the tree control.

addToSelection( Id )

func Add the treenode, with the same identification value as the value of the parameter Id, to the set of selected treenodes.
pre The parameter Id must contain an integer value.
post If there was a node with the same identification as Id then it will be selected.

makeSelectionBlock( Id )

func Add all the treenodes between the current node and and the node with the same identification value as the value of the parameter Id, to the set of selected treenodes.
pre The parameter Id must contain an integer value.
post If there was a node with the same identification as Id then all nodes between it and the 'old' current will be selected.

findFirstSelected( ResultId )

func Find the first treenode in the tree control that is selected, the search starts at the top of the tree control.
pre TRUE
post The identification value of the first node encountered that is selected is unified with the value of the parameter ResultId. If the control contains no selected nodes then no value will be unified with ResultId.

findNextSelected( Id, ResultId )

func Find the next treenode in the tree control that is selected, the search starts at the node identified by the value of the parameter Id.
pre The parameter Id must contain an integer value.
post The identification value of the next node encountered that is selected is unified with the value of the parameter ResultId. If the control contains no more selected nodes then no value will be unified with ResultId.

enableDragDrop( YesNo )

func Enable or disable the ability to drag and drop treenodes inside the tree control and between different tree controls.
pre The variable YesNo must contain either 'true' or 'false'.
post If YesNo was 'true' then drag and drop is enabled, else it is disabled.
arrow.gif (1632 bytes) see putDragAcceptFiles of the window class.

dragDropEnabled( Result )

func Check if the ability to drag and drop treenodes is enabled or disabled.
pre TRUE
post If drag and drop was enabled then the value true was unified with the parameter Result, else false.

dragDropEnabled( Result )

func Check if the ability to drag and drop treenodes is enabled or disabled.
pre TRUE
post If drag and drop was enabled then the value true was unified with the parameter Result, else false.

putFontCurrentNode( Font )

func Set the font to use by the current treenode of the control for drawing text.
pre The variable Font must refer to an instance of the class font.
post The current treenode of the control will use the contents of the variable Font for drawing text.

putFontCurrentNode( Height, Name, Bold )

func Set the height, name and bold properties of the font to use by the current treenode of the control for drawing text. The height is in pixels.
pre The variable Height must contain an integer value, the name variable must be a string. The variable Bold must have the boolean value true or false.
post The properties of the font of the current treenode were changed according to the specified parameters.

putFontCurrentNode( Height, Name, Bold, Italic, Strikethrough, Underline, clr(R, G, B) )

func Set the properties of the font to use by the current treenode of the control for drawing text. The height, name, bold, italic, strikethrough, underline and color properties of the font can be specified. The height is in pixels.
pre The variable Height must contain an integer value, the name variable must be a string. The variables Bold, Italic, Strikethrough and Underline must have boolean values (true or false). The variables R, G and B must be integers in the range [0, 255].
post The properties of the font of the current treenode were changed according to the specified parameters.

resetFontCurrentNode

func Reset the font to use by the current treenode of the control for drawing text. The current node will start using the default font of the control.
pre TRUE
post The current treenode of the control will use the default font of the treeview control for drawing text.

depthOfCurrentNode( Output )

func Determine the depth of the current treenode of the treeview control. The depth of a node is the number of nodes between it and the top-most node in the treeview control.
pre TRUE
post The depth of the current treenode was unified with the parameter Output.

depthOfNode( Id, Output )

func Determine the depth of the treenode identified by the value Id of the treeview control. The depth of a node is the number of nodes between it and the top-most node in the treeview control.
pre The parameter Id must contain an integer value.
post The depth of a treenode was unified with the parameter Output.

putBackgroundColor( R, G, B )

func Set the background color of the treeview control.
pre The variables R, G, and B must contain integer values in the range [0, 255].
post The background color was changed to the color specified by the variables R, G and B.

backgroundColor( R, G, B )

func Get the background color of the entire treeview control.
pre TRUE.
post The Red, Green and Blue values of the background color were unified with the values of  the variables R, G and B.

useSystemBackgroundColor

func Set the background color of the treeview control to the default Windows background color for controls.
pre TRUE.
post The default background color for controls will be used.

putPaintCurrent( PaintType )

func Determine how the current node in the treeview control should be drawn differently to differentiate it from the other nodes. The argument PaintType can be one of the following atomic constants: background or bold. If it is background then the background color of the current item is different than the background color of all the other nodes. If the value of the PaintType parameter is bold then the text of the current item is drawn with a bold text font (in this case the background of the current item is identical to the background of the other items).
pre The value of the parameter PaintType must be 'background' or 'bold'.
post If the value of the PaintType parameter was background then the background color of the current node will be different, if the value was bold then the text of the current node will be drawn with a bold text font.

paintCurrent( PaintType )

func Check how the current node in the treeview control is drawn to differentiate it from the other nodes.
pre TRUE
post If the background of the current node is drawn with a different background color then the value of the parameter is unified with the value background. Else if the text of the current node is drawn with a bold text font then the PaintType parameter is unified with bold.

putDrawFocusRect( YesNo )

func Determine if a focus rectangle is drawn around the current node in the treeview control or not.
pre The value of the boolean parameter YesNo must be true or false.
post If YesNo was 'true' then a focus rectangle is drawn around the current node, else not.

drawFocusRect( Output )

func Check if a focus rectangle is drawn around the current node in the treeview control or not.
pre TRUE
post If a focus rectangle is drawn around the current node then the parameter Output is unified with the value true, else with the value false.

putDrawHorLinesBetweenNodes( YesNo )

func Determine if horizontal lines are are drawn between nodes.
pre The value of the boolean parameter YesNo must be true or false.
post If YesNo was 'true' then are horizontal lines drawn between nodes, else not.

drawHorLinesBetweenNodes( Output )

func Check if horizontal lines are are drawn between nodes.
pre TRUE
post If horizontal lines are drawn between nodes then the parameter Output is unified with the value true, else it is unified with the value false.

putEditorCurrentNode( YesNo, EditorType, Result )

func Determine if an editor may appear for the current node or not. With an editor is it possible that the user changes the text of the node. The allowed values of the parameter EditorType are: edit or edit_extra. If the value is edit then the user may edit the text of the treenode. If EditorType is edit_extra then the extra text attribute of a treenode may be edited.
pre The value of the boolean parameter YesNo must be true or false. The EditorType parameter may have the values edit or edit_extra.
post If YesNo was 'true' then the user may edit the text or extra text of a node, else the user may not edit any of the properties of a node.

currentNodeHasEditor( Output )

func Check if an editor may appear for the current node or not.
pre TRUE
post If an editor may appear for the current node then was 'true' unified with the value of the parameter Output, else was false unified with Output.

currentNodeHideEditor

func Hide the editor of the current node.
pre TRUE
post No editor appears for the current node.

callbacks

onBeforeInsertNode( Sender, HasParent, ParentId, Id, IsAllowed )

func This callback event is executed while a treenode is being added to the tree control. The first parameter is the control that sends the event. The parameter HasParent, is a boolean value that indicates if the node being added has a parent node, the next parameter is the identification value of the parent node. The fourth parameter, Id, is the identification value of the node being added. The last parameter is a variable that can be unified with a boolean value to determine if the node may be added or not.
pre The variable Sender refers to the tree control which sends the event. The parameters Id and ParentId contain an integer value and HasParent is either true or false. The parameter IsAllowed is a variable.
post If the variable IsAllowed was unified with the boolean value false then the new node will not be added to the tree control.

onBeforeDeleteNode( Sender, HasParent, ParentId, Id, IsAllowed )

func This callback event is executed while a treenode is being deleted from the tree control. The first parameter is the control that sends the event. The parameter HasParent, is a boolean value that indicates if the node being deleted has a parent node, the next parameter is the identification value of the parent node. The fourth parameter, Id, is the identification value of the node being added. The last parameter is a variable that can be unified with a boolean value to determine if the node may be deleted or not.
pre The variable Sender refers to the tree control which sends the event. The parameters Id and ParentId contain an integer value and HasParent is either true or false. The parameter IsAllowed is a variable.
post If the variable IsAllowed was unified with the boolean value false then the node will not be deleted from the tree control.

onBeforeToggleNode( Sender, Id, IsExpanded, IsAllowed )

func This callback event is executed while a treenode is being toggled, i.e. this means that the user or the program is busy opening or closing the children of a node. The first parameter is the control that sends the event. The parameter Id is the identification value of the node. The next parameter, IsExpanded, is a boolean value describing the current toggle state of the node. If this parameter is false the children of the node are not visible. The last parameter is a variable that can be unified with a boolean value to determine if the node may be toggled or not.
pre The variable Sender refers to the tree control which sends the event. The parameter Id contains an integer value and IsExpanded is either true or false. The parameter IsAllowed is a variable.
post If the variable IsAllowed was unified with the boolean value false then the node will not be toggled.

onSelectNode( Sender, PrevExist, Prev, Id )

func This callback event is executed while a treenode is being selected. The first parameter is the control that sends the event. The parameter PrevExist, is a boolean value that indicates if there was a previous selected node. And if the value of the PrevExist parameter is true then the parameter Prev is the identification value of the 'old' selected node. Id is the identification value of the new selected node.
This event is also send if the user clicks on the current node, the identification values of the parameters 'Prev' and 'Id' are then equal.
pre The variable Sender refers to the tree control which sends the event. The parameter PrevExist contains a boolean value. The parameters Prev and Id both contain an integers.
post TRUE
arrow.gif (1632 bytes) use the onMouseUp event of the window class if you want to respond to a new current node.