From df03213660361b1c771f0a3f21b6ddaeaef7763a Mon Sep 17 00:00:00 2001 From: QuakeGod <quakegod@sina.com> Date: 星期二, 05 九月 2023 11:44:52 +0800 Subject: [PATCH] add ladder to prog 1 --- MTerm1/ViewTree.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/MTerm1/ViewTree.cpp b/MTerm1/ViewTree.cpp index 7b53a6c..008d138 100644 --- a/MTerm1/ViewTree.cpp +++ b/MTerm1/ViewTree.cpp @@ -2,6 +2,7 @@ #include "pch.h" #include "framework.h" #include "ViewTree.h" +#include "MTerm1.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -21,6 +22,9 @@ } BEGIN_MESSAGE_MAP(CViewTree, CTreeCtrl) +// ON_NOTIFY_REFLECT(NM_DBLCLK, &CViewTree::OnDblClkTree) +// ON_NOTIFY_REFLECT(NM_CLICK, &CViewTree::OnClkTree) + END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// @@ -40,3 +44,33 @@ return bRes; } + +void CViewTree::OnClkTree(NMHDR* pNMHDR, LRESULT* pResult) +{ + + HTREEITEM hTreeItem = GetSelectedItem(); + //浠etItemText()鍑芥暟涓轰緥锛� + CString S1 = GetItemText(hTreeItem); +// AfxMessageBox(_T("You have selected ") + S1); + + *pResult = 0; + +} + +void CViewTree::OnDblClkTree(NMHDR* pNMHDR, LRESULT* pResult) +{ + LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR); + + HTREEITEM hTreeItem = GetSelectedItem(); + //浠etItemText()鍑芥暟涓轰緥锛� + CString s2 = GetItemText(hTreeItem); + //AfxMessageBox(_T("You have selected ") + s1); + CString s1; + DWORD_PTR dw = GetItemData(hTreeItem); + s1.Format(_T("dbclk action %d, id %d oldid %d data %d x %d y %d text %s "), + pNMTreeView->action, hTreeItem, pNMTreeView->itemOld.hItem, dw, pNMTreeView->ptDrag.x, pNMTreeView->ptDrag.y,s2); + + SysLog(s1); + + *pResult = 0; +} -- Gitblit v1.9.1