Chapter 20. TreeControl Class

Table of Contents
Methods of the TreeControl Class
Notification Messages

The tree view control is a dialog that displays a hierarchical list of items, such as the headings in a document, the entries in an index, or the files and directories on a disk. Each item consists of a label and an optional image bitmap, and can have a list of subitems associated with it. By clicking on an item, the user can expand and collapse the associated list of subitems.

Refer to OODTREE.REX in the OODIALOG\SAMPLES directory for an example.

Requires:

The TreeControl class requires the class definition file oodwin32.cls:

::requires "oodwin32.cls"

Methods:

Instances of the TreeControl class implement the methods listed in the TreeControl Instance Methods table.

Table 20-1. TreeControl Instance Methods

Method......on page
AddAdd
ChildChild
CollapseCollapse
CollapseAndResetCollapseAndReset
DeleteDelete
DeleteAllDeleteAll
DropHighlightDropHighlight
DropHighlightedDropHighlighted
EditEdit
EndEditEndEdit
EnsureVisibleEnsureVisible
ExpandExpand
FirstVisibleFirstVisible
HitTestHitTest
IndentIndent
Indent=Indent=
InsertInsert
IsAncestorIsAncestor
ItemInfoItemInfo
ItemsItems
MakeFirstVisibleMakeFirstVisible
ModifyModify
MoveItemMoveItem
NextNext
NextVisibleNextVisible
ParentParent
PreviousPrevious
PreviousVisiblePreviousVisible
RemoveImages (deprecated)RemoveImages (deprecated)
RestoreEditClassRestoreEditClass
RootRoot
SelectSelect
SelectedSelected
SetImages (deprecated)SetImages (deprecated)
SortChildrenSortChildren
SubclassEditSubclassEdit
ToggleToggle
VisibleItemsVisibleItems

Methods of the TreeControl Class

The following sections describe the individual methods of the TreeControl class.

Insert

                                    +-"LAST"--+     +-""---+     +-0-----+
>>-aTreeControl~Insert(--parent--,--+-after---+--,--+------+--,--+-------+--,-->
                                    +-"FIRST"-+     +-text-+     +-image-+
                                    +-"SORT"--+

                                                   +-"0"-+
>--+----------+--,--+------------------------+--,--+-----+--)--><
   +-selImage-+     |    +--------------+    |     +-"1"-+
                    |    V              |    |
                    +-"----+-EXPANDED-+-+--"-+
                           +-BOLD-----+


The Insert method inserts a new item in a tree view control.

Arguments:

The arguments are:

parent

The handle to the parent item. If you specify "ROOT", the item is inserted at the root of the tree view control.

after

The handle to the item after which the new item is to be inserted or one of the following values:

"FIRST"

Inserts the item at the beginning of the list.

"LAST"

Inserts the item at the end of the list. This is the default.

"SORT"

Inserts the item into the list in alphabetical order.

text

The text for the item. If you omit this argument, "" is assumed.

image

The index of the icon image in the tree view control's bitmap file to be used when the item is in the non-selected state. If you omit this argument, the icon with index 0 is used.

selImage

The index of the icon image in the tree view control's bitmap file to be used when the item is in the selected state. If you omit this argument, the icon specified for image is used.

state

Specifies the appearance and functionality of the item. It can be a combination of the following values, separated by a blank:

EXPANDED

The item is currently expanded with all child items visible. This only applies to parent items.

BOLD

The item is shown in bold.

If you omit this argument, the item is inserted in collapsed and normal form.

children

Indicates whether the item has child items associated with it:

"0"

The item has no child items, which is the default.

"1"

The item has one or more child items.

You can use this argument to show an item that does not have any child items, with an expand button. This allows you to save memory usage by dynamically loading and displaying the child items only when the user expands the item.

Return value:

The handle to the new item, or 0 for all other cases.

Example:

The following example inserts child items when a specific root item is expanded. The text strings for the items are loaded from a file.

::method OnExpanding_IDC_TREE
  use arg tree, item
  itemFile = "root6.inp"
  curTree = self~GetTreeControl("IDC_TREE")
  itemInfo. = curTree~ItemInfo(item)

  if itemInfo.!TEXT = "Root 6" & \itemInfo.!STATE~POS("EXPANDED") then
  do
    do while lines(itemFile)
      line = linein(itemFile)
      command = "curTree~Insert(item, ,"||line||")"
      interpret command
    end
    curTree~Expand(item)
  end

Add

                      +-------+
                      V       |     +-""---+     +-0-----+
>>-aTreeControl~Add(----+---+-+--,--+------+--,--+-------+--,--->
                        +-,-+       +-text-+     +-image-+

                                                   +-"0"-+
>--+----------+--,--+------------------------+--,--+-----+--)--><
   +-selImage-+     |    +--------------+    |     +-"1"-+
                    |    V              |    |
                    +-"----+-EXPANDED-+-+--"-+
                           +-BOLD-----+


The Add method adds a new item to a tree view control.

Arguments:

The arguments are:

,

The number of commas specifies at which parent the item is to be inserted. If you omit this argument, the item is inserted as a root item. Each additional comma inserts the item one level deeper than the item inserted previously. See the example in the following.

text

The text for the item. If you omit this argument, "" is assumed.

image

The index of the icon image in the tree view control's bitmap file to be used when the item is in the non-selected state. If you omit this argument, the icon with index 0 is used.

selImage

The index of the icon image in the tree view control's bitmap file to be used when the item is in the selected state. If you omit this argument, the icon specified for image is used.

state

Specifies the appearance and functionality of the item. It can be a combination of the following values, separated by a blank:

EXPANDED

The item is currently expanded with all child items visible. This only applies to parent items.

BOLD

The item is shown in bold.

If you omit this argument, the item is inserted in collapsed and normal form.

children

Indicates whether the item has child items associated with it:

"0"

The item has no child items, which is the default.

"1"

The item has one or more child items.

You can use this argument to show an item that does not have any child items, with an expand button. This allows you to save memory usage by dynamically loading and displaying the child items only when the user expands the item.

Return value:

The handle to the new item, or 0 for all other cases.

Example:

To get the following tree view:

  • Peter

    • Mike

      • George

      • Monique

        • John

      • Chris

    • Maud

    • Ringo

  • Paul

    • Dave

    • Sam

    • Jeff

  • Mary

    • Helen

    • Michelle

    • Diana

your example must look as follows:

::method InitDialog
  InitDlgRet = self~InitDialog:super
  curTree = self~GetTreeControl("IDC_TREE")
  if curTree \= .Nil then
  do
    curTree~Add("Peter", , ,"BOLD EXPANDED")
    curTree~Add(,"Mike", , ,"EXPANDED")
    curTree~Add(, ,"George")
    curTree~Add(, ,"Monique")
    curTree~Add(, , ,"John")
    curTree~Add(, ,"Chris")
    curTree~Add(,"Maud")
    curTree~Add(,"Ringo")
    curTree~Add("Paul", , ,"BOLD EXPANDED")
    curTree~Add(,"Dave")
    curTree~Add(,"Sam")
    curTree~Add(,"Jeff")
    curTree~Add("Mary", , ,"BOLD EXPANDED")
    curTree~Add(,"Helen")
    curTree~Add(,"Michelle")
    curTree~Add(,"Diana")
end

Modify

                                   +-""---+     +-0-----+
>>-aTreeControl~Modify(--hItem--,--+------+--,--+-------+--,--+----------+--,-->
                                   +-text-+     +-image-+     +-selImage-+

                                         +-"0"-+
>--+-------------------------------+--,--+-----+--)------------><
   |    +---------------------+    |     +-"1"-+
   |    V                     |    |
   +-"----+-BOLD------------+-+--"-+
          +-NOTBOLD---------+
          +-DROP------------+
          +-NOTDROP---------+
          +-SELECTED--------+
          +-NOTSELECTED-----+
          +-CUT-------------+
          +-NOTCUT----------+
          +-EXPANDEDONCE----+
          +-NOTEXPANDEDONCE-+
          +-EXPANDED--------+
          +-NOTEXPANDED-----+


The Modify method sets some or all attributes of an item of a tree view control.

Arguments:

The arguments are:

hItem

The handle to the item to be modified.

text

The text for the item. If you omit this argument, "" is assumed.

image

The index of the icon image in the tree view control's bitmap file to be used when the item is in the non-selected state. If you omit this argument, the icon with index 0 is used.

selImage

The index of the icon image in the tree view control's bitmap file to be used when the item is in the selected state. If you omit this argument, the icon specified for image is used.

state

Specifies the appearance and functionality of the item. It can be one or more of the following values, separated by blanks:

BOLD

The item is shown in bold.

NOTBOLD

The item is not bold.

DROP

The item is selected as a drag-and-drop target.

NOTDROP

The item is not selected as a drag-and-drop target.

SELECTED

The item is selected. Its appearance depends on whether it has the focus and whether the system colors are used for the selection.

NOTSELECTED

The item is not selected.

CUT

The item is selected as part of a cut-and-paste operation.

NOTCUT

The item is not selected as part of a cut-and-paste operation.

EXPANDEDONCE

The item's list of child items has been expanded at least once.

NOTEXPANDEDONCE

The item's list of child items has not been expanded at least once.

EXPANDED

The item's list is currently expanded with all child items visible. This only applies to parent items.

NOTEXPANDED

The item's list is currently not expanded.

children

Indicates whether the item has child items associated with it:

"0"

The item has no child items, which is the default.

"1"

The item has one or more child items.

You can use this argument to show an item that does not have any child items, with an expand button. This allows you to save memory usage by dynamically loading and displaying the child items only when the user expands the item.

Return value:

0

The item has been modified.

-1

For all other cases.

Example:

The following example changes the text of the item to bold when it is selected:

::method OnSelChanging_IDC_TREE
  curTree = self~GetTreeControl("IDC_TREE")
  curTree~Modify(curTree~selected, , , ,"BOLD")

ItemInfo

>>-aTreeControl~ItemInfo(--hItem--)----------------------------><


The ItemInfo method retrieves some or all attributes of an item of a tree view control.

Arguments:

The only argument is:

hItem

The handle to the item of which attributes are to be retrieved.

Return value:

A compound variable that stores the attributes of the item, or -1 in all other cases. The compound variable can be:

RetStem.!TEXT

The text of the item.

RetStem.!CHILDREN

1

The item has children.

0

The item has no children.

RetStem.!IMAGE

The index of the icon image in the tree view control's bitmap file used when the item is in the non-selected state.

RetStem.!SELECTEDIMAGE

The index of the icon image in the tree view control's bitmap file used when the item is in the selected state.

RetStem.!STATE

An empty string or one or more of the following strings, separated by blanks:

EXPANDED

The item's list is currently expanded with all child items visible. This only applies to parent items.

BOLD

The item is in bold.

SELECTED

The item is selected.

EXPANDEDONCE

The item's list has been expanded at least once. This only applies to parent items.

INDROP

The item is selected as a drag-and-drop target.

Example:

The following example displays the attributes of the selected item:

::method Info
  curTree = self~GetTreeControl("IDC_TREE")
  itemInfo. = curTree~ItemInfo(curTree~Selected)
  say itemInfo.!TEXT
  say itemInfo.!CHILDREN
  say itemInfo.!IMAGE
  say itemInfo.!STATE

Items

>>-aTreeControl~Items------------------------------------------><


The Items method retrieves the number of items in a tree view control.

Return value:

The number of items.

Example:

The following example counts all items in a tree view control:

::method Count
  curTree = self~GetTreeControl("IDC_TREE")
  say curTree~Items

VisibleItems

>>-aTreeControl~VisibleItems-----------------------------------><


The VisibleItems method obtains the number of items that can be fully visible in a tree view control. This number can be greater than the number of items in the control. The control calculates this value by dividing the height of the client window by the height of an item.

Return value:

The number of items that can be fully visible. For example, if you can see all of 19 items and part of another item, the return value is 19, not 20.

Example:

The following example returns the number of items that can be fully visible:

::method Visible
  curTree = self~GetTreeControl("IDC_TREE")
  say curTree~VisibleItems

Root

>>-aTreeControl~Root-------------------------------------------><


The Root method retrieves the first or topmost item of the tree view control.

Return value:

The handle to the first item, or 0 in all other cases.

Example:

The following example displays the name of the root item:

::method RootName
  curTree = self~GetTreeControl("IDC_TREE")
  itemInfo. = curTree~ItemInfo(curTree~Root)
  say ItemInfo.!Text

Parent

>>-aTreeControl~Parent(--hItem--)------------------------------><


The Parent method retrieves the parent of the specified item.

Arguments:

The only argument is:

hItem

The handle to the item for which the parent is to be retrieved.

Return value:

The handle to the parent item, or -1 if hItem is not specified or is 0, or 0 in all other cases.

Example:

The following example displays the name of the selected item's parent:

::method Parent
  curTree = self~GetTreeControl("IDC_TREE")
  itemInfo. = curTree~ItemInfo(curTree~Parent(curTree~Selected))
  say ItemInfo.!Text

Child

>>-aTreeControl~Child(--hItem--)-------------------------------><


The Child method retrieves the first child item of hItem.

Arguments:

The only argument is:

hItem

The handle to the item of which the first child is to be retrieved.

Return value:

The handle to the first child item, or -1 if you omitted hItem, or 0 in all other cases.

Example:

The following example displays the name of parent of the selected item:

::method Child
  curTree = self~GetTreeControl("IDC_TREE")
  itemInfo. = curTree~ItemInfo(curTree~Child(curTree~Selected))
  say ItemInfo.!Text

Selected

>>-aTreeControl~Selected---------------------------------------><


The Selected method retrieves the currently selected item.

Return value:

The handle to the currently selected item, or 0 in all other cases.

Example:

The following example displays the name of the selected item:

::method SelectedName
  curTree = self~GetTreeControl("IDC_TREE")
  itemInfo. = curTree~ItemInfo(curTree~Selected)
  say ItemInfo.!Text

DropHighlighted

>>-aTreeControl~DropHighlighted--------------------------------><


The DropHighlighted method retrieves the item that is the target of a drag-and-drop operation.

Return value:

The handle to the item, or 0 in all other cases.

FirstVisible

>>-aTreeControl~FirstVisible-----------------------------------><


The FirstVisible method retrieves the first visible item in the client window of a tree view control.

Return value:

The handle to the first visible item, or 0 in all other cases.

Example:

The following example displays the name of the first visible item:

::method FirstVisibleName
  curTree = self~GetTreeControl("IDC_TREE")
  itemInfo. = curTree~ItemInfo(curTree~FirstVisible)
  say ItemInfo.!Text

Next

>>-aTreeControl~Next(--hItem--)--------------------------------><


The Next method retrieves the sibling item next to hItem.

Arguments:

The only argument is:

hItem

The handle to the item next to the sibling item to be retrieved.

Return value:

The handle to the next sibling item, or -1 if you omitted hItem, or 0 in all other cases.

Example:

The following example displays the name of the selected item and its siblings:

::method SiblingNames
  curTree = self~GetTreeControl("IDC_TREE")
  nextItem = curTree~Selected
  do while nextItem \= 0
    itemInfo. = curTree~ItemInfo(nextItem)
    say ItemInfo.!Text
    nextItem = curTree~Next(nextItem)
  end

NextVisible

>>-aTreeControl~NextVisible(--hItem--)-------------------------><


The NextVisible method retrieves the visible item following hItem.

Arguments:

The only argument is:

hItem

The handle to the item that precedes the visible item to be retrieved. hItem must also be visible.

Return value:

The handle to the next visible item, or -1 if you omitted hItem, or 0 in all other cases.

Previous

>>-aTreeControl~Previous(--hItem--)----------------------------><


The Previous method retrieves the sibling item preceding hItem.

Arguments:

The only argument is:

hItem

The handle to the item that follows the sibling item to be retrieved.

Return value:

The handle to the previous sibling item, or -1 if hItem is not specified or is 0, or 0 in all other cases.

PreviousVisible

>>-aTreeControl~PreviousVisible(--hItem--)---------------------><


The PreviousVisible method retrieves the visible item preceding hItem.

Arguments:

The only argument is:

hItem

The handle to the item that follows the visible child item to be retrieved. hItem must also be visible.

Return value:

The handle to the previous visible child item, or -1 if hItem is not specified or is 0, or 0 in all other cases.

Delete

>>-aTreeControl~Delete(--hItem--)------------------------------><


The Delete method removes an item from a tree view control.

Arguments:

The only argument is:

hItem

The handle to the item to be deleted.

Return value:

0

The item was deleted.

1

An error occurred.

-1

hItem is 0 or is not a valid value.

Example:

The following example deletes the selected item and all its children, if any:

::method IDC_PB_DELETE
  curTree = self~GetTreeControl("IDC_TREE")
  curTree~Delete(curTree~Selected)

DeleteAll

>>-aTreeControl~DeleteAll--------------------------------------><


The DeleteAll method removes all items from a tree view control.

Return value:

0

The items were removed.

1

For all other cases.

Collapse

>>-aTreeControl~Collapse(--hItem--)----------------------------><


The Collapse method collapses the list of child items associated with the specified parent item.

Arguments:

The only argument is:

hItem

The handle to the parent item to collapse.

Return value:

0

The list of child items has collapsed.

-1

hItem is not specified or is 0.

1

For all other cases.

Example:

The following example collapses the selected item:

::method CollapseSelected
  curTree = self~GetTreeControl("IDC_TREE")
  curTree~Collapse(curTree~Selected)

CollapseAndReset

>>-aTreeControl~CollapseAndReset(--hItem--)--------------------><


The CollapseAndReset method collapses the list of child items associated with the specified parent item and removes the child items.

Arguments:

The only argument is:

hItem

The handle to the parent item to collapse.

Return value:

0

The list of child items has collapsed and the child items have been removed.

-1

hItem is not specified or is 0.

1

For all other cases.

Example:

The following example collapses the selected item and removes all its child items:

::method CollapseSelectedAndReset
  curTree = self~GetTreeControl("IDC_TREE")
  curTree~CollapseAndReset(curTree~Selected)

Expand

>>-aTreeControl~Expand(--hItem--)------------------------------><


The Expand method expands the list of child items associated with the specified parent item.

Arguments:

The only argument is:

hItem

The handle to the parent item to be expanded.

Return value:

0

The parent item was expanded.

-1

hItem is not specified or is 0.

1

For all other cases.

Example:

The following example expands the selected item:

::method ExpandSelected
  curTree = self~GetTreeControl("IDC_TREE")
  curTree~Expand(curTree~Selected)

Toggle

>>-aTreeControl~Toggle(--hItem--)------------------------------><


The Toggle method collapses the list of the specified item if it was expanded, or expands it if it was collapsed.

Arguments:

The only argument is:

hItem

The handle to the item to be expanded or collapsed.

Return value:

0

The item was expanded or collapsed.

-1

hItem is not specified or is 0.

1

For all other cases.

Example:

The following example toggles between expanding and collapsing a selected item:

::method ToggleSelected
  curTree = self~GetTreeControl("IDC_TREE")
  curTree~Toggle(curTree~Selected)

EnsureVisible

>>-aTreeControl~EnsureVisible(--hItem--)-----------------------><


The EnsureVisible method ensures that a tree view item is visible, expanding the parent item or scrolling the tree view control, if necessary.

Arguments:

The only argument is:

hItem

The handle to the item to be visible.

Return value:

0

The items in the tree view control were scrolled to ensure that the specified item is visible.

-1

hItem is not specified or is 0.

1

For all other cases.

Indent

>>-aTreeControl~Indent-----------------------------------------><


The Indent method retrieves the amount, in pixels, by which the child items are indented relative to their parent item.

Return value:

The amount indented, in pixels.

Indent=

>>-aTreeControl~Indent=--indent--------------------------------><


The Indent= method sets the width of indentation for a tree view control and redraws the control to reflect the new width.

Arguments:

The only argument is:

indent

The width of the indentation, in pixels. If you specify a width that is smaller than the system-defined minimum, it is set to the system-defined minimum.

Return value:

-1 if indent is 0.

Edit

>>-aTreeControl~Edit(--hItem--)--------------------------------><


The Edit method starts editing the text of the specified item by replacing the text with a single-line edit control containing this text. It implicitly selects and focuses the specified item.

Arguments:

The only argument is:

hItem

The handle to the item to be edited.

Return value:

The handle to the edit control used to edit the item text, or -1 if hItem is not specified or is 0, or 0 in all other cases.

EndEdit

>>-aTreeControl~EndEdit(--+--------+--)------------------------><
                          +-cancel-+


The EndEdit method ends the editing of the item label of the tree view.

Arguments:

The only argument is:

cancel

Indicates whether editing is canceled without being saved to the label. If you specify "1" or "YES", editing is canceled. Otherwise, the changes are saved to the label, which is the default.

Return value:

0

Editing has ended successfully.

1

For all other cases.

SubclassEdit

>>-aTreeControl~SubclassEdit-----------------------------------><


The SubclassEdit method is used by the DefTreeEditHandler to correct the problem occurring when Esc or the Enter key is pressed in an active edit item.

RestoreEditClass

>>-aTreeControl~RestoreEditClass-------------------------------><


The RestoreEditClass method is used by the DefTreeEditHandler to correct the problem occurring when Esc or the Enter key is pressed in an active edit item.

Select

>>-aTreeControl~Select(--hItem--)------------------------------><


The Select method selects a specific item.

Arguments:

The only argument is:

hItem

The handle to the item to be selected.

Return value:

0

The item was selected.

-1

hItem was not specified or is 0.

1

For all other cases.

MakeFirstVisible

>>-aTreeControl~MakeFirstVisible(--hItem--)--------------------><


The MakeFirstVisible method ensures that hItem is visible and displays it at the top of the control's dialog, if possible. If the specified item is near the end of the control's hierarchy of items, it might not become the first visible item depending on how many items fit in the dialog.

Arguments:

The only argument is:

hItem

The handle to the item to be visible first.

Return value:

0

The item is visible first.

-1

hItem was not specified or is 0.

1

For all other cases.

DropHighlight

>>-aTreeControl~DropHighlight(--hItem--)-----------------------><


The DropHighlight method redraws hItem in the style used to indicate the target of a drag-and-drop operation.

Arguments:

The only argument is:

hItem

The handle of the item to be redrawn.

Return value:

0

The item was redrawn.

-1

hItem was not specified or is 0.

1

For all other cases.

SortChildren

>>-aTreeControl~SortChildren(--hItem--)------------------------><


The SortChildren method sorts the child items of the specified parent item in a tree view control.

Arguments:

The only argument is:

hItem

The handle to the parent item the child items of which are to be sorted.

Return value:

0

The child items were sorted.

-1

hItem was not specified or is 0.

1

For all other cases.

setImageList

>>--setImageList(--newImageList--+----------+--)--------------------><
                                 +--,-type--+

Assigns, or removes, an image list for the tree-view control. Using .nil for the first argument removes the current image list. Tree-view controls can have two image lists. The normal image list, which contains selected, nonselected, and overlay images for the items of a tree-view control. And, the state image list. The state images can be used by the programmer to indicate application-defined item states. A state image is displayed to the left of an item's selected or nonselected image.

The tree-view control does not destroy an image list that is associated with it. The programmer must destroy the image list separately, if desired. This is useful if the same image list is assigned to multiple tree-view controls. In essence, the ownership of the image list remains with the programmer. The ImageList and Image classes are used to manage image lists and images in ooDialog. The documentation on both classes discusses when and why the programmer may want to release image lists. The Image class documentation has the most detail on this subject.

Details

Raises syntax errors when incorrect arguments are detected.

Arguments:

The arguments are:

newImageList

The image list to assign to the tree-view. If this argument is .nil the existing image list, if any, is removed.

type

Optional. Specifies which image list to assign, (or remove.) You can use .Image~toID() to get the correct numeric value for one of the following symbols:

TVSIL_NORMALTVSIL_STATE

or use the correct numeric value itself.

The default is TVSIL_NORMAL.

Return value:

The existing image list is returned, if there is one. Otherwise, .nil is returned.

Example:

This example creates an image list and assigns it to the tree-view control for use as the normal image list.


  /* set images for the items */
  image = .Image~getImage("bmp\psdemotv.bmp")
  imageList = .ImageList~create(.Size~new(32, 32), .Image~toID(ILC_COLOR8), 10, 0)
  if \image~isNull,  \imageList~isNull then do
     imageList~add(image)
     tc~setImageList(imageList, .Image~toID(TVSIL_NORMAL))
     image~release
  end

getImageList

>>--getImageList(--+--------+--)------------------------------------><
                   +--type--+

Retrieves the current image list for the type specified. The default is to retrieve the tree-views normal image list. See the () method for infomation on assigning an image list to a tree-view control.

Details

Raises syntax errors when incorrect arguments are detected.

Arguments:

The single optional argument is:

type

Optional. Specifies which image list to retrieve. You can use .Image~toID() to get the correct numeric value for one of the following symbols:

TVSIL_NORMALTVSIL_STATE

or use the correct numeric value itself.

The default is TVSIL_NORMAL.

Return value:

This method returns the current image list, if there is one. .nil is returned if there is no current image list of the type specified.

Example:

This example releases the tree-view's image lists, if they exist, when the dialog ends.

  ::method ok
  self~doImageLists return self~ok:super

::method cancel
  self~doImageLists
  return self~cancel:super

::method odImageLists
  expose treeView

  types = .array~of(TVSIL_NORMAL, TVSIL_STATE)

  do type over types
    il = treeView~getImageList(type)
    if il \== .nil then il~release
  end

setImages (deprecated)

Note: This method is deprecated. It is replaced by the functionally equivalent setImageList() method. Do not use this method in new code. Try to migrate existing code to to the setImageList() method. This method may not exist in future versions of ooDialog.

removeImages (deprecated)

Note: This method is deprecated. It is replaced by the functionally equivalent setImageList() method. Do not use this method in new code. Try to migrate existing code to to the setImageList() method. This method may not exist in future versions of ooDialog.

HitTest

>>-aTreeControl~HitTest(--x--,--y--)---------------------------><


The HitTest method determines the location of the specified point relative to the client area of a tree view control.

Arguments:

The arguments are:

x

The x-coordinate of the point.

y

The y-coordinate of the point.

Return value:

0 if no item occupies the point, or one or more of the following strings if an item occupies the specified point:

handle

The handle to the item that occupies the specified point.

ABOVE

Above the client area.

BELOW

Below the client area.

NOWHERE

In the client area but below the last item.

ONITEM

On the bitmap or label associated with an item.

ONBUTTON

On the button associated with an item.

ONICON

On the icon associated with an item.

ONINDENT

In the indentation associated with an item.

ONLABEL

On the label (string) associated with an item.

ONRIGHT

In the area to the right of an item.

ONSTATEICON

On the state icon for a tree view item that is in a user-defined state.

TOLEFT

To the left of the client area.

TORIGHT

To the right of the client area.

MoveItem

>>-aTreeControl~MoveItem(--hItem--,--hNewParent--,--redraw--+---------------+--)-><
                                                            +-,--"NODELETE"-+
                                                            +-,--"SIBLINGS"-+


The MoveItem method moves an item to a new location.

Arguments:

The arguments are:

hItem

The handle to the item to be moved.

hNewParent

The handle to the new parent to which the item is to be moved.

redraw

The tree view control is updated.

options

One of the following options:

"NODELETE"

The item is copied to another location.

"SIBLINGS"

Siblings are moved together with the item.

Return value:

The handle to the new parent, or 0 in all other cases.

IsAncestor

>>-aTreeControl~IsAncestor(--hParent--,--hItem--)--------------><


The IsAncestor method checks if an item is an ancestor of another item.

Arguments:

The arguments are:

hParent

The ancestor.

hItem

The item to be checked.

Return value:

1 if hParent is an ancestor of hItem.