?
Solved

CtreeCtrl's child item

Posted on 1998-02-07
3
Medium Priority
?
951 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 150 total points
ID: 1315749
This is the code you need:

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

0

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

771 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