开发者

TVN_SELCHANGING not received

I have a WTL81 app. CMainFrame has a child CPaneContainer, that has a child window CTreeViewCtrl. The problem is CTreeViewCtrl doesn't receive TVN_SELCHANGING message.

I have "spied" CTreeViewCtrl and his parent (CPaneContainer) and no notification code is received.

CMainFrame is implemented from public CFrameWindowImpl<CMainFrame>

CPaneContainer is implemented like this

class PaneContainerReflectNotif : public CPaneContainer 
{
    BEGIN_MSG_MAP(PaneContainerReflectNotif)
        CHAIN_MSG_MAP(CPaneContainer)
        REFLECT_NOTIFICATIONS()
    END_MSG_MAP()
};

Tree is implemented like this

class MyTreeView : 
    public CWindowImpl<CatalogTreeView, CTreeViewCtrl>,
    public CCustomDraw<CatalogTreeView>,
    public CTheme

   ...

BEGIN_MSG_MAP_EX(MyTreeView )
    MSG_WM_CREATE(OnCreate)
 开发者_运维知识库   MSG_WM_DESTROY(OnDestroy)
    REFLECTED_NOTIFY_CODE_HANDLER_EX(NM_DBLCLK, OnDblClick)
    REFLECTED_NOTIFY_CODE_HANDLER_EX(TVN_ITEMEXPANDING, OnItemExpanding)
    REFLECTED_NOTIFY_CODE_HANDLER_EX(TVN_SELCHANGING, OnSelChanged)

OnDblClick - works fine

OnItemExpanding - works fine

OnSelChanged - doesn't work

any ideas on what could be the problem ?


Solved. My problem was that treeview was multi-selct and that kind of tree doesn't send TVN_SELCHANGING notifications


You have not mentioned why do you need TVN_SELCHANGING. The event gets fired when the tree nodes are getting changed, and another tree node is being selected.

As an alternative, you might try TVN_SELCHANGED or HitTest( ). I am providing a MFC link .. http://msdn.microsoft.com/en-us/library/x0w7ft34.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜