Solved

CtreeCtrl's child item

Posted on 1998-02-07
3
935 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Turn a spreadsheet into a vba executable. 2 86
Get filename and folder into excel 7 75
Perl Awk Need Help 3 118
Annoying "thing" blocks my view 4 100
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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 shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

778 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