Solved

CtreeCtrl's child item

Posted on 1998-02-07
3
922 Views
Last Modified: 2013-11-19
I would like to have sample codes to 'SetFocus' to a particular child item of a CTreeCtrl. The child info available is its item.lParam value.

Thanx.  
0
Comment
Question by:engllf
3 Comments
 
LVL 7

Expert Comment

by:galkin
ID: 1315747
CTreeCtrl::SetItemState(hItem, TVIS_SELECTED, TVIF_STATE);
0
 

Author Comment

by:engllf
ID: 1315748
Hi,
As i have only the lParam value of the child item, i tried to get the hItem of the child item using the below code.  But i have problem with the GetItem() function.  It returns something that is not what i want. (I think the mask value is not set correctly.) BTW, I am using a CTreeView.

TV_ITEM TVItem ;
TVItem.lParam = (LPARAM) 1001 ; // i only know this lParam value
TVItem.mask = TVIF_PARAM ; //which flag needs to be included here?  

CTreeCtrl& MyTree = GetTreeCtrl() ;
if (MyTree.GetItem(&TVItem) ==  0)
{
    AfxMessageBox("error");
    return -1 ;
}

MyTree.SetItemState(TVItem.hItem, TVIS_SELECTED, TVIF_STATE) ;
0
 
LVL 1

Accepted Solution

by:
winmeister earned 50 total points
ID: 1315749
This is the code you need:

SetItemState(TVItem.hItem, TVIS_DROPHILITED | TVIS_SELECTED, TVIS_DROPHILITED | TVIS_SELECTED);

0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now