|
Question : CTreeView MFC Help
|
|
I have just created a single document with Doc/view architecture, IE rebars, and a 'windows explorer' style MFC Appwizard application. (I also changed the CView to CFormView). I'm using MSVC++6.0 on WindowsNT4sp4 and Win98
I have the tree control on the left and the form view on the right in the splitter. I populated the tree control, but there are no lines, or +- buttons beside the items, making it kinda hard to see the relationship of parent/child in the tree.
What I can not figure out is how to change the style of the tree control to TVS_HASLINES and TVS_HASBUTTONS (at least). I can't figure out where this tree control is created, or how to change it!
I've hardly changed anything over what AppWizard has created so far... (I'm just learning this tree control stuff, if you can tell) :)
|
|
Answer : CTreeView MFC Help
|
|
Hi gunn, The best way is to derive your own class from CTreeCtrl, let's say: CMyTreeCtrl. Then add the virtual function Create(), and in that function you say: { if( [baseclass].create(...) == FALSE ) { return FALSE; } this->ModifyStyle( 0, TVS_HASLINES,0);}
A better way is to create your project again. In the last step, let your View-class derive from CTreeView. Then you can add the virtual function Create, and say:
GetTreeCtrl().ModifyStyle( 0, TVS_HASLINES,0);
Hope this helps. BTW, I suppose you know how to derive your own classes and add virtual functions. If not, let me know
|
|
|
|