September 26, 2022, 06:04:27 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Root item in Treeview

Started by ExMember001, September 16, 2006, 09:34:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ExMember001

Is there a way to get the root item handle from one of its children?

Ionic Wind Support Team

I usually store the parent's handle as the child items user data (SetItemData), which allows for quick traversal back up the tree.

Or you can use the API to get it:


#define TV_FIRST 0x1100
#define TVM_GETNEXTITEM         (TV_FIRST + 10)
#define TVGN_PARENT             0x0003
DECLARE IMPORT,SendMessageA(hwnd as UINT,uMsg as UINT,wParam as UINT,lParam as UINT),UINT;


sub GetParentItem(UINT hTreeView,UINT hChildItem),UINT
{
     return SendMessageA(hTreeView, TVM_GETNEXTITEM, TVGN_PARENT, hChildItem);
}

Ionic Wind Support Team

Ionic Wind Support Team

Sorry, You asked for the root.  You can use the same method but change TVGN_PARENT to TVGN_ROOT:

#define TVGN_ROOT               0x0000
Ionic Wind Support Team

ExMember001