![]() |
CXTTreeCtrl mutli selection problems |
Post Reply
|
| Author | |
scottp
Groupie
Joined: 16 October 2006 Status: Offline Points: 59 |
Post Options
Thanks(0)
Quote Reply
Topic: CXTTreeCtrl mutli selection problemsPosted: 17 August 2007 at 10:24am |
|
We are using the CXTTreeCtrl in multi-select mode and have found that tracking the items being selected and deselected using the TVN_SELCHANGED message does not work when selecting multiple items using CTRL and SHIFT. The visual appearance of the trees selection is correct but it is impossible to track the changes.
I have attached a modified TreeCtrl sample that helps show the problem (use the multiselect tree) - message boxes will popup to show which items are being selected and deselected. uploads/20070817_102009_TreeCtrl_Sample.zip Test scenario 1:
|
|
![]() |
|
Alex
Groupie
Joined: 12 May 2004 Status: Offline Points: 54 |
Post Options
Thanks(0)
Quote Reply
Posted: 11 January 2008 at 5:26pm |
|
Hi,
could you solve this problem ?
I have the same problem...
Regards.
Alex
|
|
![]() |
|
scottp
Groupie
Joined: 16 October 2006 Status: Offline Points: 59 |
Post Options
Thanks(0)
Quote Reply
Posted: 15 January 2008 at 9:01pm |
|
Hi,
I did find a way to get around this by filtering out focus changes in OnSelectionChange. BOOL CMyTreeCtrl::OnSelectionChange (NMHDR* pNMHDR, LRESULT* pResult) { NMTREEVIEW* pTv; pTv = (NMTREEVIEW*)pNMHDR; *pResult = 0; HTREEITEM hFocusedItem = GetFocusedItem (); HTREEITEM hNewItem = pTv->itemNew.hItem; HTREEITEM hOldItem = pTv->itemOld.hItem; if ( !hFocusedItem && hOldItem && !hNewItem ) { // then me must have a Focus change and we don't want to process this as a selection change. } else { if (hNewItem) { CMyTreeItem* pData = GetMyTreeItem (hNewItem); //select item } if (hOldItem) { CMyTreeItem* pData = GetMyTreeItem (hOldItem); // deselect item } } Hope this helps |
|
![]() |
|
Alex
Groupie
Joined: 12 May 2004 Status: Offline Points: 54 |
Post Options
Thanks(0)
Quote Reply
Posted: 16 January 2008 at 5:27am |
|
Thank you.
I have found a similar solution.
Regards,
Alex
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |