
HTREEITEM TreeView_GetNextItem(
HWND hwndTV,
HTREEITEM hitem,
UINT flag
);
Retrieves the tree view item that bears the specified relationship to a specified item. You can use this macro, use one of the TreeView_Get macros described below, or send the TVM_GETNEXTITEM message explicitly.
| TVGN_CARET | Retrieves the currently selected item. You can use the TreeView_GetSelection macro to send this message. |
| TVGN_CHILD | Retrieves the first child item of the item specified by the hitem parameter. You can use the TreeView_GetChild macro to send this message. |
| TVGN_DROPHILITE | Retrieves the item that is the target of a drag-and-drop operation. You can use the TreeView_GetDropHilight macro to send this message. |
| TVGN_FIRSTVISIBLE | Retrieves the first visible item. You can use the TreeView_GetFirstVisible macro to send this message. |
| TVGN_NEXT | Retrieves the next sibling item. You can use the TreeView_GetNextSibling macro to send this message. |
| TVGN_NEXTVISIBLE | Retrieves the next visible item that follows the specified item. The specified item must be visible. Use the TVM_GETITEMRECT message to determine whether an item is visible. You can use the TreeView_GetNextVisible macro to send this message. |
| TVGN_PARENT | Retrieves the parent of the specified item. You can use the TreeView_GetParent macro to send this message. |
| TVGN_PREVIOUS | Retrieves the previous sibling item. You can use the TreeView_GetPrevSibling macro to send this message. |
| TVGN_PREVIOUSVISIBLE | Retrieves the first visible item that precedes the specified item. The specified item must be visible. Use the TVM_GETITEMRECT message to determine whether an item is visible. You can use the TreeView_GetPrevVisible macro to send this message. |
| TVGN_ROOT | Retrieves the topmost or very first item of the tree view control. You can use the TreeView_GetRoot macro to send this message. |
HTREEITEM TreeView_GetNextSibling(
HWND hwndTV,
HTREEITEM hitem
);
Retrieves the next sibling item of a specified item in a tree view control. You can use this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_NEXT flag.
See also TreeView_GetChild, TreeView_GetNextItem, TreeView_GetParent, TreeView_GetPrevSibling
HTREEITEM TreeView_GetNextVisible(
HWND hwndTV,
HTREEITEM hitem
);
Retrieves the next visible item that follows a specified item in a tree view control. You can use this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_NEXTVISIBLE flag.
See also TreeView_GetFirstVisible, TreeView_GetNextItem, TreeView_GetPrevVisible
HTREEITEM TreeView_GetParent(
HWND hwndTV,
HTREEITEM hitem
);
Retrieves the parent item of the specified tree view item. You can use this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_PARENT flag.
See also TreeView_GetChild, TreeView_GetNextItem, TreeView_GetNextSibling, TreeView_GetPrevSibling
HTREEITEM TreeView_GetPrevSibling(
HWND hwndTV,
HTREEITEM hitem
);
Retrieves the previous sibling item of a specified item in a tree view control. You can use this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_PREVIOUS flag.
See also TreeView_GetChild, TreeView_GetNextItem, TreeView_GetNextSibling, TreeView_GetParent
HTREEITEM TreeView_GetPrevVisible(
HWND hwndTV,
HTREEITEM hitem
);
Retrieves the first visible item that precedes a specified item in a tree view control. You can use this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_PREVIOUSVISIBLE flag.
See also TreeView_GetFirstVisible, TreeView_GetNextItem, TreeView_GetNextVisible
HTREEITEM TreeView_GetRoot(
HWND hwndTV
);
Retrieves the topmost or very first item of the tree view control. You can use this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_ROOT flag.
See also TreeView_GetNextItem
UINT TreeView_GetScrollTime(
HWND hwndTV
);
Retrieves the maximum scroll time for the tree view control. You can use this macro or send the TVM_GETSCROLLTIME message explicitly.
The maximum scroll time is the longest amount of time that a scroll operation can take. Scrolling will be adjusted so that the scroll will take place within the maximum scroll time. A scroll operation may take less time than the maximum.
See also TreeView_SetScrollTime
HTREEITEM TreeView_GetSelection(
HWND hwndTV
);
Retrieves the currently selected item in a tree view control. You can use this macro, or you can explicitly send the TVM_GETNEXTITEM message with the TVGN_CARET flag.
See also TreeView_GetNextItem
COLORREF TreeView_GetTextColor(
HWND hwndTV
);
Retrieves the current text color of the control. You can use this macro or send the TVM_GETTEXTCOLOR message explicitly.
Version 4.71
See also TreeView_SetTextColor
HWND TreeView_GetToolTips(
HWND hwndTV
);
Retrieves the handle to the child tooltip control used by a tree view control. You can use this macro or send the TVM_GETTOOLTIPS message explicitly.
When created, tree view controls automatically create a child tooltip control. To prevent a tree view control from using tooltips, create the control with the TVS_NOTOOLTIPS style.
Version 4.70
See also TreeView_SetToolTips
BOOL TreeView_GetUnicodeFormat(
HWND hwnd
);
Retrieves the UNICODE character format flag for the control. You can use this macro or send the TVM_GETUNICODEFORMAT message explicitly.
See also TreeView_SetUnicodeFormat
UINT TreeView_GetVisibleCount(
HWND hwndTV
);
Obtains the number of items that can be fully visible in the client window of a tree view control. You can use this macro or send the TVM_GETVISIBLECOUNT message explicitly.
The number of items that can be fully visible may 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.
Note that the return value is the number of items that can be fully visible. If you can see all of 20 items and part of one more item, the return value is 20.
HTREEITEM TreeView_HitTest(
HWND hwndTV,
LPTVHITTESTINFO lpht
);
Determines the location of the specified point relative to the client area of a tree view control. You can use this macro or send the TVM_HITTEST message explicitly.
HTREEITEM TreeView_InsertItem(
HWND hwndTV,
LPTVINSERTSTRUCT lpis
);
Inserts a new item in a tree view control. You can use this macro or send the TVM_INSERTITEM message explicitly.
See also TVN_ENDLABELEDIT
BOOL TreeView_Select(
HWND hwndTV,
HTREEITEM hitem,
UINT flag
);
Selects the specified tree view item, scrolls the item into view, or redraws the item in the style used to indicate the target of a drag-and-drop operation. You can use this macro or the TreeView_SelectItem, TreeView_SelectSetFirstVisible, or TreeView_SelectDropTarget macros, or you can send the TVM_SELECTITEM message explicitly.
| TVGN_CARET | Sets the selection to the given item. The control's parent window receives the TVN_SELCHANGING and TVN_SELCHANGED notification messages. |
| TVGN_DROPHILITE | Redraws the given item in the style used to indicate the target of a drag-and-drop operation. |
| TVGN_FIRSTVISIBLE | Ensures that the specified item is visible, and, if possible, displays it at the top of the control's window. Tree view controls display as many items as will fit in the window. If the specified item is near the bottom of the control's hierarchy of items, it might not become the first visible item, depending on how many items fit in the window. |
If the specified item is the child of a collapsed parent item, the parent's list of child items is expanded to reveal the specified item. In this case, the parent window receives the TVN_ITEMEXPANDING and TVN_ITEMEXPANDED notification messages.
BOOL TreeView_SelectDropTarget(
HWND hwndTV,
HTREEITEM hitem
);
Redraws a specified tree view control item in the style used to indicate the target of a drag-and-drop operation. You can use this macro or the TreeView_Select macro, or you can send the TVM_SELECTITEM message explicitly.
If the specified item is the child of a collapsed parent item, the parent's list of child items is expanded to reveal the specified item. In this case, the parent window receives the TVN_ITEMEXPANDING and TVN_ITEMEXPANDED notification messages.
Using the TreeView_SelectDropTarget macro is equivalent to sending the TVM_SELECTITEM message with its flag parameter set to the TVGN_DROPHILITE value.
BOOL TreeView_SelectItem(
HWND hwndTV,
HTREEITEM hitem
);
Selects the specified tree view item. You can use this macro or the TreeView_Select macro, or you can send the TVM_SELECTITEM message explicitly.
When you call the TreeView_SelectItem macro, the control's parent window receives the TVN_SELCHANGING and TVN_SELCHANGED notification messages. Also, if the specified item is the child of a collapsed parent item, the parent's list of child items is expanded to reveal the specified item. In this case, the parent window receives the TVN_ITEMEXPANDING and TVN_ITEMEXPANDED notification messages.
Using the TreeView_SelectItem macro is equivalent to sending the TVM_SELECTITEM message with its flag parameter set to the TVGN_CARET value.
COLORREF TreeView_SetBkColor(
HWND hwndTV
COLORREF clrBk;
);
Sets the background color of the control. You can use this macro or send the TVM_SETBKCOLOR message explicitly.
Version 4.71
See also TreeView_GetBkColor
BOOL TreeView_SelectSetFirstVisible(
HWND hwndTV,
HTREEITEM hitem
);
Scrolls the tree view control vertically to ensure that the specified item is visible. If possible, the specified item becomes the first visible item at the top of the control's window. You can use this macro or the TreeView_Select macro, or you can send the TVM_SELECTITEM message explicitly.
Tree view controls display as many items as will fit in the window. If the specified item is near the bottom of the control's hierarchy of items, it might not become the first visible item, depending on how many items fit in the window.
If the specified item is the child of a collapsed parent item, the parent's list of child items is expanded to reveal the specified item. In this case, the parent window receives the TVN_ITEMEXPANDING and TVN_ITEMEXPANDED notification messages.
Using the TreeView_SelectSetFirstVisible macro is equivalent to sending the TVM_SELECTITEM message with its flag parameter set to the TVGN_FIRSTVISIBLE value.
HIMAGELIST TreeView_SetImageList(
HWND hwndTV,
HIMAGELIST himl,
INT iImage
);
Sets the normal or state image list for a tree view control and redraws the control using the new images. You can use this macro or send the TVM_SETIMAGELIST message explicitly.
| TVSIL_NORMAL | Indicates the normal image list, which contains selected, nonselected, and overlay images for the items of a tree view control. |
| TVSIL_STATE | Indicates the state image list. You can use state images to indicate application-defined item states. A state image is displayed to the left of an item's selected or nonselected image. |
See also TreeView_GetImageList, TVM_GETIMAGELIST
BOOL TreeView_SetIndent(
HWND hwndTV,
INT indent
);
Sets the width of indentation for a tree view control and redraws the control to reflect the new width. You can use this macro or send the TVM_SETINDENT message explicitly.
BOOL TreeView_SetInsertMark(
HWND hwndTV,
HTREEITEM htiInsert,
BOOL fAfter
);
Sets the insertion mark in a tree view control. You can use this macro or send the TVM_SETINSERTMARK message explicitly.
Version 4.71
COLORREF TreeView_SetInsertMarkColor(
HWND hwndTV,
COLORREF clrInsertMark
);
Sets the color used to draw the insertion mark for the tree view. You can use this macro or send the TVM_SETINSERTMARKCOLOR message explicitly.
Version 4.71
See also TreeView_GetInsertMarkColor
BOOL TreeView_SetItem(
HWND hwndTV,
LPTVITEM pitem
);
Sets some or all of a tree view item's attributes. You can use this macro or send the TVM_SETITEM message explicitly.
int TreeView_SetItemHeight(
HWND hwndTV,
SHORT cyItem
);
Sets the height of the tree view items. You can use this macro or send the TVM_SETITEMHEIGHT message explicitly.
The tree view control uses this value for the height of all items. To modify the height of individual items, see the description of the iIntegral member of the TVITEMEX structure.
Version 4.71
See also TreeView_GetItemHeight
UINT TreeView_SetScrollTime(
HWND hwndTV,
UINT uMaxScrollTime
);
Sets the maximum scroll time for the tree view control. You can use this macro or send the TVM_SETSCROLLTIME message explicitly.
The maximum scroll time is the longest amount of time that a scroll operation can take. Scrolling will be adjusted so that the scroll will take place within the maximum scroll time. A scroll operation may take less time than the maximum.
See also TVM_GETSCROLLTIME
COLORREF TreeView_SetTextColor(
HWND hwndTV
COLORREF clrText;
);
Sets the text color of the control. You can use this macro or send the TVM_SETTEXTCOLOR message explicitly.
Version 4.71
See also TreeView_GetTextColor
HWND TreeView_SetToolTips(
HWND hwndTV,
HWND hwndTooltip
);
Sets a tree view control's child tooltip control. You can use this macro or send the TVM_SETTOOLTIPS message explicitly.
When created, tree view controls automatically create a child tooltip control. To prevent a tree view control from using tooltips, create the control with the TVS_NOTOOLTIPS style.
Version 4.70
See also TreeView_GetToolTips
BOOL TreeView_SetUnicodeFormat(
HWND hwnd,
BOOL fUnicode
);
Sets the UNICODE character format flag for the control. This message allows you to change the character set used by the control at run time rather than having to re-create the control. You can use this macro or send the TVM_SETUNICODEFORMAT message explicitly.
See also TreeView_GetUnicodeFormat
BOOL TreeView_SortChildren(
HWND hwndTV,
HTREEITEM hitem,
BOOL fRecurse
);
Sorts the child items of the specified parent item in a tree view control. You can use this macro or send the TVM_SORTCHILDREN message explicitly.
BOOL TreeView_SortChildrenCB(
HWND hwndTV,
LPTVSORTCB psort,
BOOL fRecurse
);
Sorts tree view items using an application-defined callback function that compares the items. You can use this macro or send the TVM_SORTCHILDRENCB message explicitly.
This section contains information about the notification messages that are sent by tree view controls.
NM_CLICK
lpnmh = (LPNMHDR) lParam;
Notifies a tree view control's parent window that the user has clicked the left mouse button within the control. This notification is sent in the form of a WM_NOTIFY message.
NM_CUSTOMDRAW
lpNMCustomDraw = (LPNMTVCUSTOMDRAW) lParam;
Sent by a tree view control to notify its parent window about drawing operations. This notification is sent in the form of a WM_NOTIFY message.
When dwDrawStage equals CDDS_PREPAINT:
|
When dwDrawStage equals CDDS_ITEMPREPAINT:
|
Version 4.70
See also Using Custom Draw
NM_DBLCLK
lpnmh = (LPNMHDR) lParam;
Notifies a tree view control's parent window that the user has double-clicked the left mouse button within the control. This notification is sent in the form of a WM_NOTIFY message.
NM_KILLFOCUS
lpnmh = (LPNMHDR) lParam;
Notifies a tree view control's parent window that the control has lost the input focus. This notification is sent in the form of a WM_NOTIFY message.
NM_RCLICK
lpnmh = (LPNMHDR) lParam;
Notifies a tree view control's parent window that the user has clicked the right mouse button within the control. This notification is sent in the form of a WM_NOTIFY message.
NM_RETURN
lpnmh = (LPNMHDR) lParam;
Notifies a tree view control's parent window that the control has the input focus and that the user has pressed the ENTER key. This notification is sent in the form of a WM_NOTIFY message.
NM_SETCURSOR
lpnmm = (LPNMMOUSE) lParam;
Notifies a tree view control's parent window that the control is setting the cursor in response to a WM_SETCURSOR message. This notification is sent in the form of a WM_NOTIFY message.
Version 4.71.
NM_SETFOCUS
lpnmh = (LPNMHDR) lParam;
Notifies a tree view control's parent window that the control has received the input focus. This notification is sent in the form of a WM_NOTIFY message.
TVN_BEGINDRAG
pnmtv = (LPNMTREEVIEW) lParam
Notifies a tree view control's parent window that a drag-and-drop operation involving the left mouse button is being initiated. This notification message is sent in the form of a WM_NOTIFY message.
A tree view control that has the TVS_DISABLEDRAGDROP style does not send this notification message.
TVN_BEGINLABELEDIT
ptvdi = (LPNMTVDISPINFO) lParam
Notifies a tree view control's parent window about the start of label editing for an item. This notification message is sent in the form of a WM_NOTIFY message.
TVN_BEGINRDRAG
pnmtv = (LPNMTREEVIEW) lParam
Notifies a tree view control's parent window about the initiation of a drag-and-drop operation involving the right mouse button. This notification message is sent in the form of a WM_NOTIFY message.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.