Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Onkeydown() event in CXTTreeBase
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Onkeydown() event in CXTTreeBase

 Post Reply Post Reply
Author
Message
abazosan View Drop Down
Newbie
Newbie


Joined: 24 May 2007
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote abazosan Quote  Post ReplyReply Direct Link To This Post Topic: Onkeydown() event in CXTTreeBase
    Posted: 06 October 2008 at 11:27am
Hi there,
 
I've got a CXTTree based class. I capture the OnKeyDown() event and it works fine.
 
When I navigate the tree with arrows up and down(even with SHIFT pressed), I capture the event, I get the list of selected items and refresh some information for all of them.
 
But, when I try to navigate the tree with the first letter of an item (pressing character 'c' to go to car...and so), list of selected items is empty so I can't do anything with it.
 
Is like the event launches after the selection of the next item with arrows, but before the selection of the next item with an alphanumeric character..
 
Is this a bug or am I doing something wrong?
 
This my code in OnKeyDown() method, if it helps

"void CMyClassView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)

{

CXTTreeView::OnKeyDown(nChar, nRepCnt, nFlags);
 
tSetLong setSelectedTags;

long lFocusedTag= -1L;

CTreeCtrl &rTree= GetTreeCtrl();

CTypedPtrList<CPtrList, HTREEITEM> listItems;

GetSelectedList(listItems);

POSITION pos= listItems.GetHeadPosition();

while (pos != NULL)

{

HTREEITEM hti= listItems.GetNext(pos);

if (hti != NULL)

{

long lCode= rTree.GetItemData(hti);

setSelectedItems.insert(lCode);

HTREEITEM hti= GetFocusedItem();

TreeSelectionHasChanged(lFocusedTag);

}

}"
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 07 October 2008 at 2:17am

Hi,


Think you need TVN_SELCHANGED notification. User can select item with mouse also...

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
abazosan View Drop Down
Newbie
Newbie


Joined: 24 May 2007
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote abazosan Quote  Post ReplyReply Direct Link To This Post Posted: 21 October 2008 at 10:55am
It worked well!
 
Thank you Oleg, you are very good.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.