|
-
September 9th, 1999, 03:40 PM
#1
TreeView Style
I've derived a class based on a TreeView. When I actually put the TreeView in a window, it comes up as a generic "style-less" tree control. How do I modify the style of the TreeView? I've tried overriding the "OnCreate" and doing this:
BOOL CArcInfoTree::Create(LPCTSTR lpszClassName,
LPCTSTR lpszWindowName, DWORD dwStyle, const
RECT& rect, CWnd* pParentWnd, UINT nID,
CCreateContext* pContext)
{
dwStyle |= TVS_HASBUTTONS;
return CWnd::Create(lpszClassName,
lpszWindowName, dwStyle, rect, pParentWnd, nID,
pContext);
}
But it doesn't do anything.
-
September 9th, 1999, 10:33 PM
#2
Re: TreeView Style
I suggest you use ModifyStyle or ModifyStyleEx to change the styles. For example:
ModifyStyle(0, TVS_HASBUTTONS);
The fisrt parameter is the OFF BITS and the second is the ON BITS.
Place that code in the TreeView OnInitialUpdate()
Good luck
Jaime
-
September 10th, 1999, 09:41 AM
#3
Re: TreeView Style
I tried this, but it doesn't work. I tried both ModifyStyle and ModifyStyleEx.
Does it matter that it is a TreeView in a SplitterWnd?
-
September 10th, 1999, 09:47 AM
#4
Re: TreeView Style
You must change this style before the TreeView is created. You can do this in the function PreCreateWindow (Overwrite with ClassWizard).
BOOL CMyTreeView::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style |= TVS_HASBUTTONS;
return CTreeView::PreCreateWindow(cs) ;
}
-
September 10th, 1999, 09:51 AM
#5
Re: TreeView Style
Actually The way to get it to work is the type of styles you implement. THIS is what works.
BOOL CArcInfoTree::Create(LPCTSTR lpszClassName,
LPCTSTR lpszWindowName, DWORD dwStyle, const
RECT& rect, CWnd* pParentWnd, UINT nID,
CCreateContext* pContext)
{
dwStyle |= (TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS);
return CWnd::Create(lpszClassName,
lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
Thanks for all the help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|