Tree View Problem
Sandeep Khamesra -- sandeep@novell.com Monday, April 01, 1996 VC++ 4.0 w95 I have a treeview in my application.It works fine but the problem is lines does not come up? Where I have to specify that tree control should " have Lines and lines at Root" . There is no API or MFC call to do it? Can any one help me.. Sandy
Mike Blaszczak -- mikeblas@msn.com Tuesday, April 02, 1996 [Mini-digest: 6 responses] These attributes are controlled by control styles bits. You can set them by playing with the property page in the dialog editor against your dialog or by setting the appropriate styles bits in OnPreCreateWindow() if you're using a CTreeListView. .B ekiM -----From: Mark WilliamsonYou need to do as shown below. The hwnd is the hwnd of the tree control if you are using a treeview then GetTreeCtrl() will return the CTreeCtrl SetWindowLong( hwnd , GWL_STYLE , GetWindowLong( hwnd , GWL_STYLE ) | TVS_HASLINES | TVS_LINESATROOT |TVS_HASBUTTONS); -----From: kpandya@harbinger.net (Kanir Pandya) When you create the treeview control you specify the style of treeview control. Following is the code that might help you. CTreeCtrl* pTree; pTree->Create(WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS |TVS_SHOWSELALWAYS, rect, this,ID_TREE_CTRL)) This is done with MFC 4.0. -----From: Cleve Littlefield Use TVS_HASLINES & TVS_LINESATROOT styles in the OnCreate part of the view, where the view creates the TreeCtrl. -- ********************************* * * * Cleve W. Littlefield * * halfacre@intermind.net * * kurt@skylink.net * * * ********************************* -----From: Gonzalo Isaza You have to specify the style when you create the tree control. For a treeview you will have to override PreCreateWindow member function (for the view) and set the style right there. Change the value in cs.style to include the styles you want, and then call the base class PreCreateWindow member function. You might also want to check the cmnctrls sample which creates and handles different styles for the tree control for extra information on how to handle the tree view.. Gonzalo Isaza [I speak for myself. I don't speak as Microsoft] -----From: "Albert Szilvasy" put this line into the PreCreateWindow of your CTreeView derived class: cs.style|=TVS_HASLINES | TVS_LINESATROOT; Cheers, Albert -- UofV,Hungary
| Вернуться в корень Архива |