Click here to Skip to main content
16,007,443 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Help me with storage problem! Pin
David Crow3-Jan-07 7:31
David Crow3-Jan-07 7:31 
AnswerRe: Help me with storage problem! Pin
CPallini3-Jan-07 8:20
mveCPallini3-Jan-07 8:20 
GeneralRe: Help me with storage problem! Pin
davvid3-Jan-07 14:47
davvid3-Jan-07 14:47 
QuestionHandle of an item in tree view. Pin
priyank_ldce3-Jan-07 5:07
priyank_ldce3-Jan-07 5:07 
AnswerRe: Handle of an item in tree view. Pin
led mike3-Jan-07 5:54
led mike3-Jan-07 5:54 
GeneralRe: Handle of an item in tree view. Pin
Ray Kinsella3-Jan-07 6:27
Ray Kinsella3-Jan-07 6:27 
GeneralRe: Handle of an item in tree view. Pin
led mike3-Jan-07 8:16
led mike3-Jan-07 8:16 
AnswerRe: Handle of an item in tree view. Pin
Ray Kinsella3-Jan-07 6:22
Ray Kinsella3-Jan-07 6:22 
You can write a function to recursively iterate through the treeview nodes looking for the Text. So it would look something like this, bear in mind this is peusdocode, you also consider what happens when there are duplicates.

HTREEITEM hr = FindNode(NodeText, RootNode);

HTREEITEM FindNode(std::String NodeText, HTREEITEM myNode)
{
	HTREEITEM hr = INVALID_HANDLE;

	//get the text for the current node
	std::string s = treeview->getItemText(myNode);
	
	//return if its the right node
	if(s.compare(NodeText) == 0) return myNode;

	//if not examine this nodes children, if it has any
	if(treeview->hasChildren(myNode))
	{
		hr = FindNode(threeview->getFirstChild(myNode));
		if(hr != INVALID_HANDLE) return hr;
	}
	
	//if not examine this nodes children, if it has any
	if(treeview->hasSiblings(myNode))
	{
		hr = FindNode(threeview->getNextSibling(myNode));
		if(hr != INVALID_HANDLE) return hr;
	}
	
	//if all else fails return invalid handle
	return INVALID_HANDLE;
}




Regards

Ray

"Je Suis Mort De Rire"
Blogging @ Keratoconus Watch


GeneralRe: Handle of an item in tree view. Pin
led mike3-Jan-07 8:14
led mike3-Jan-07 8:14 
GeneralRe: Handle of an item in tree view. Pin
Ray Kinsella3-Jan-07 11:15
Ray Kinsella3-Jan-07 11:15 
QuestionMFC /CRecordset Pin
Bravoone_20063-Jan-07 3:13
Bravoone_20063-Jan-07 3:13 
QuestionRe: MFC /CRecordset Pin
David Crow3-Jan-07 4:11
David Crow3-Jan-07 4:11 
AnswerRe: MFC /CRecordset Pin
Hamid_RT3-Jan-07 17:36
Hamid_RT3-Jan-07 17:36 
Questionbeginners inc++ Pin
ellarond3-Jan-07 3:06
ellarond3-Jan-07 3:06 
AnswerRe: beginners inc++ Pin
Hamid_RT3-Jan-07 3:55
Hamid_RT3-Jan-07 3:55 
AnswerRe: beginners inc++ Pin
David Crow3-Jan-07 4:13
David Crow3-Jan-07 4:13 
GeneralRe: beginners inc++ Pin
ellarond3-Jan-07 5:15
ellarond3-Jan-07 5:15 
QuestionRe: beginners inc++ Pin
David Crow3-Jan-07 5:31
David Crow3-Jan-07 5:31 
AnswerRe: beginners inc++ Pin
ellarond3-Jan-07 6:16
ellarond3-Jan-07 6:16 
GeneralRe: beginners inc++ Pin
David Crow3-Jan-07 7:42
David Crow3-Jan-07 7:42 
GeneralOT Pin
Astricks3-Jan-07 3:05
Astricks3-Jan-07 3:05 
GeneralRe: OT Pin
Hamid_RT3-Jan-07 3:55
Hamid_RT3-Jan-07 3:55 
GeneralRe: OT Pin
Astricks3-Jan-07 5:24
Astricks3-Jan-07 5:24 
GeneralRe: OT Pin
toxcct3-Jan-07 10:23
toxcct3-Jan-07 10:23 
GeneralRe: OT Pin
Astricks3-Jan-07 19:51
Astricks3-Jan-07 19:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.