Reputation: 1037
I mean click on element of treeview - > it show sth in listview.
I create controls like this(where tree and list - > CTreeViewCtrl and CListViewCtrl)
split.Create(*this,rcDefault,NULL,0,WS_EX_CLIENTEDGE);
RECT rlist,rtree;
list.Create(split,rlist,CListViewCtrl::GetWndClassName(),WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | LVS_REPORT | LVS_EDITLABELS, WS_EX_CLIENTEDGE);
tree.Create(split,rtree,CTreeViewCtrl::GetWndClassName(),WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | LVS_REPORT | TVS_EDITLABELS, WS_EX_CLIENTEDGE);
list.AddColumn(L"KEY",0);
list.AddColumn(L"VALUE",1);
split.SetSplitterPanes(tree,list);
What parameters will have the event function?
Upvotes: 0
Views: 757
Reputation: 2929
In your mainfrm.h
// ...
CTreeViewCtrlEx m_treeview;
// ...
BEGIN_MSG_MAP(CMainFrame)
// ...
NOTIFY_CODE_HANDLER(TVN_SELCHANGED, OnTVSelChanged)
END_MSG_MAP()
and
// mainfrm.h or mainfrm.cpp
LRESULT CMainFrame::OnTVSelChanged(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
{
//...
}
Upvotes: 0
Reputation: 69632
TVN_SELCHANGED notification code:
Notifies a tree-view control's parent window that the selection has changed from one item to another. This notification code is sent in the form of a WM_NOTIFY message.
That is, when you click an item and it changes selection of treeview control, the control sends WM_NOTIFY
message to its parent (such as your dialog) with code TVN_SELCHANGED
and you are supposed to handle it.
Upvotes: 1