Documentation for Win32lib v0.60.6
Table of Contents

TreeView Control

These routines deal with the TreeView common control.


The following routines support TreeView as well as other controls:
  • deleteItem
  • eraseItems
  • getIndex
  • getItem
  • getData

    The following routines are specific to the TreeView control.

  • addTVItem
  • expandTV
  • getTVIndex
  • getTVParent
  • getTVSelectedText
  • getTVText
  • hitTestTV
  • removeTVItem
  • setTVImages
  • setTVParent
  • setTVText
  • struct_TVHITTESTINFO
  • struct_TVINSERTSTRUCT
  • struct_TVITEM

  • func addTVItem( integer id, atom iImage, atom iSelectedImage, sequence text, integer iParent )    Add an item to a TreeView
  • proc collapseItem( id )    Hides the children of a single TreeView Item
  • proc expandItem( id )    Show the children of a single TreeView Item
  • func expandTV(object TVID, object ItemID, integer Action)   Expands or Collapses all child tree items.
  • func getTVIndex( atom id )   Find which is the selected item in a treeview.
  • func getTVParent( id )    Get the parent id of a TreeView item.
  • func getTVSelectedText( integer id )   Gets the text associated with the selected item in a TreeView.
  • func getTVText( integer iItem )   Gets the text associated with a TreeView item.
  • func hitTestTV( id )    Check to see if mouse is over a TreeView item
  • proc setTVImages( integer iItem, atom NewImage, atom NewSelected )   Sets the images associated with a TreeView item.
  • proc setTVText( integer iItem, sequence NewText )   Sets the text associated with a TreeView item.
  • proc toggleItem( id )    Shows or Hides the children of a single TreeView Item

    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    addTVItem
    ( integer id, atom iImage, atom iSelectedImage, sequence text, integer iParent )

    Add an item to a TreeView

    Returns: Index to item.

    Category: TreeView Control

  • id: TreeView to add to
  • iImage: Index to default image
  • iSelectedImage: Index to image for when item is selected
  • text: String of text to be displayed for item
  • iParent: index of parent item. Should be 0 if item is at root. See addIcon, addEuBmp, addXpm, addDIB for information on using images with TreeViews.

    See Also: collapseItem, expandItem, expandTV, getTVIndex, getTVParent, getTVSelectedText, getTVText, hitTestTV, setTVImages, setTVText, toggleItem


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    collapseItem
    ( id )

    Hides the children of a single TreeView Item

    Category: TreeView Control

    id is the integer returned from addTVItem when the item was created.

    See Also: addTVItem, expandItem, expandTV, getTVIndex, getTVParent, getTVSelectedText, getTVText, hitTestTV, setTVImages, setTVText, toggleItem


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    expandItem
    ( id )

    Show the children of a single TreeView Item

    Category: TreeView Control

    id is the integer returned from addTVItem when the item was created.

    See Also: addTVItem, collapseItem, expandTV, getTVIndex, getTVParent, getTVSelectedText, getTVText, hitTestTV, setTVImages, setTVText, toggleItem


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    expandTV
    (object TVID, object ItemID, integer Action)

    Expands or Collapses all child tree items.

    Returns: INTEGER: The inverse of pAction

    Category: TreeView Control

    TVID is the id of a TreeView control
    ItemID is the id of a TreeView item as returned by addTVItem
    Action is either TVE_EXPAND or TVE_COLLAPSE. The default is TVE_EXPAND.
    This routine expands or collapses all the items, starting with ItemId, and continuing down the hierarchy.
    Returning the opposite of Action. Thus if Action was TVE_EXPAND then this would return TVE_COLLAPSE, and visa versa.

    Example: See demo ListTreeView.exw

          integer nextAction
          nextAction = TVE_EXPAND
          nextAction = expandTV( myTV, rootItem, nextAction)
    

    See Also: addTVItem, collapseItem, expandItem, getTVIndex, getTVParent, getTVSelectedText, getTVText, hitTestTV, setTVImages, setTVText, toggleItem


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    getTVIndex
    ( atom id )

    Find which is the selected item in a treeview.

    Returns: 0 if none selected, otherwise the Treeview item id that is selected.

    Category: TreeView Control

            integer theItem
            theItem = getTVIndex(theTreeview)
            if theItem != 0 then
               -- found a selected item
            end if
    

    See Also: addTVItem, collapseItem, expandItem, expandTV, getTVParent, getTVSelectedText, getTVText, hitTestTV, setTVImages, setTVText, toggleItem


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    getTVParent
    ( id )

    Get the parent id of a TreeView item.

    Returns: id of parent item, or 0 if item is at root, or -1 if id is invalid.

    Category: TreeView Control

    Note well. id is a TreeView ITEM and not the TreeView control.

    See Also: addTVItem, collapseItem, expandItem, expandTV, getTVIndex, getTVSelectedText, getTVText, hitTestTV, setTVImages, setTVText, toggleItem


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    getTVSelectedText
    ( integer id )

    Gets the text associated with the selected item in a TreeView.

    Returns: SEQUENCE: The selected item's text.

    Category: TreeView Control

           sequence text
           text = getTVSelectedText( theTreeView )
    

    See Also: addTVItem, collapseItem, expandItem, expandTV, getTVIndex, getTVParent, getTVText, hitTestTV, setTVImages, setTVText, toggleItem


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    getTVText
    ( integer iItem )

    Gets the text associated with a TreeView item.

    Returns: SEQUENCE: The item's text.

    Category: TreeView Control

           sequence text
           integer anItem
           anItem = addTVItem(theTreeView, img1, img2, "Hello", 0)
           . . .
           text = getTVText( anItem )
    

    See Also: addTVItem, collapseItem, expandItem, expandTV, getTVIndex, getTVParent, getTVSelectedText, hitTestTV, setTVImages, setTVText, toggleItem


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    hitTestTV
    ( id )

    Check to see if mouse is over a TreeView item

    Returns: Index of TreeView item under mouse, or zero, if none

    Category: TreeView Control

    See Also: addTVItem, collapseItem, expandItem, expandTV, getTVIndex, getTVParent, getTVSelectedText, getTVText, setTVImages, setTVText, toggleItem


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    setTVImages
    ( integer iItem, atom NewImage, atom NewSelected )

    Sets the images associated with a TreeView item.

    Category: TreeView Control

    NewImage is the image used for an unselected item, and NewSelected is the image used when the item is selected.
    If either NewImage or NewSelected is -1, the respective image is not changed.

           integer anItem
           anItem = addTVItem(theTreeView, img1, img2, "Hello", 0)
           . . .
            setTVImages( anItem, img3, -1 )
    

    See Also: addTVItem, collapseItem, expandItem, expandTV, getTVIndex, getTVParent, getTVSelectedText, getTVText, hitTestTV, setTVText, toggleItem


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    setTVText
    ( integer iItem, sequence NewText )

    Sets the text associated with a TreeView item.

    Category: TreeView Control

           integer anItem
           anItem = addTVItem(theTreeView, img1, img2, "Hello", 0)
           . . .
            setTVText( anItem, "G'Day" )
    

    See Also: addTVItem, collapseItem, expandItem, expandTV, getTVIndex, getTVParent, getTVSelectedText, getTVText, hitTestTV, setTVImages, toggleItem


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    toggleItem
    ( id )

    Shows or Hides the children of a single TreeView Item

    Category: TreeView Control

    id is the integer returned from addTVItem when the item was created.
    If the item has its children hidden, this shows them.
    If the item has its children shown, this hides them.

    See Also: addTVItem, collapseItem, expandItem, expandTV, getTVIndex, getTVParent, getTVSelectedText, getTVText, hitTestTV, setTVImages, setTVText