|
-
January 21st, 2004, 03:47 AM
#1
Disable selection in CTreeCtrl
I don't know if it is possible but I have a CTreeCtrl object with checkboxes and that works fine. The thing is that I don't like the selection in my tree. I already have checkboxes so I do not have to see what item is selected. I tried unselecting the tree item in the OnSelChanged function like this:
Code:
void CMyTree::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
HTREEITEM hItem = this->GetSelectedItem();
this->SetItemState(hItem, 0, TVIS_SELECTED );
*pResult = 0;
}
But then the selecting and unselecting is noticeable. Is there a way to completely disable the selection functionality of the CTreeCtrl class?
-
January 21st, 2004, 09:19 AM
#2
i think for this is TVN_SELCHANGING not TVN_SELCHANGED
but works with user changes only - is this your problem?
or this too? http://www.codeproject.com/dialog/reflectedmsgs.asp
t!
Last edited by real name; January 21st, 2004 at 09:21 AM.
-
January 22nd, 2004, 07:53 AM
#3
I tried changing TVN_SELCHANED to TVN_SELCHANGING but that does not work with me. I think the problem is that MFC automatically updates the tree with a visible selection after TVN_SELCHANGING.
The best solution would of course be to totally disable the selection ability. So that when a user clicks on the tree you do not see a blue bar and nothing (visually) changes.
An other (dirty) solution could be to change the selection color from blue to white. But first I want to figure out if the selection can be totally disabled.
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
|