Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 11-26-2007, 09:37 AM   #1 (permalink)
complete
Code Monkey
 
complete's Avatar
 
Join Date: Jul 2005
Location: St. Louis
Posts: 71
complete is on a distinguished road
CTree

I had thought that using a CTree control was pretty easy and straight-forward.

For the root of the CTree control, I use the insertItem method:

HTML Code:
//(where m_strRoot is a CString type)
m_hParent = m_ctrlTree.InsertItem(m_strRoot , TVI_ROOT);
And that works fine.

When I try to insert child noted into the tree, that is when I have a problem. It does not work. I use the handle I got when I inserted the root node and
TVI_LAST:

Code:
HTREEITEM hChild = m_ctrlTree.InsertItem(m_strChild, m_hParent,TVI_LAST);
Does anyone have any experience working with the MFC CTree control?
__________________
46 45 52 4D 49 20 57 41 53 20 4A 45 44 49 2E 10
20 53 41 47 41 4E 20 57 41 53 20 53 49 54 48 2E
complete is offline   Reply With Quote
Old 11-26-2007, 12:57 PM   #2 (permalink)
complete
Code Monkey
 
complete's Avatar
 
Join Date: Jul 2005
Location: St. Louis
Posts: 71
complete is on a distinguished road
By the way, is Microsoft making it so that we cannot run and test the sample code? I have download CmnCTRL1 and it will not build. It won't even attempt to compile.
__________________
46 45 52 4D 49 20 57 41 53 20 4A 45 44 49 2E 10
20 53 41 47 41 4E 20 57 41 53 20 53 49 54 48 2E
complete is offline   Reply With Quote
Old 11-26-2007, 09:51 PM   #3 (permalink)
complete
Code Monkey
 
complete's Avatar
 
Join Date: Jul 2005
Location: St. Louis
Posts: 71
complete is on a distinguished road
Well, it turns out I was coding the CTree control correctly. Sort of. The control displays the root of the tree and the user has to click on it to show the nodes underneath.

So the question now is this. How do I code the CTree control so that it comes up initially with all the nodes showing?
__________________
46 45 52 4D 49 20 57 41 53 20 4A 45 44 49 2E 10
20 53 41 47 41 4E 20 57 41 53 20 53 49 54 48 2E
complete is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 04:03 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting