From 847c81df89d512a9713807e35d449ea8d8879820 Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Tue, 28 Sep 2004 19:17:17 +0000 Subject: [PATCH] Determine whether to do label edit before sending NM_CLICK. --- dlls/comctl32/treeview.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index 91353a1a86c..a3299c03573 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -3821,7 +3821,7 @@ TREEVIEW_LButtonDown(TREEVIEW_INFO *infoPtr, LPARAM lParam) { HWND hwnd = infoPtr->hwnd; TVHITTESTINFO ht; - BOOL bTrack; + BOOL bTrack, bDoLabelEdit; HTREEITEM tempItem; /* If Edit control is active - kill it and return. @@ -3854,6 +3854,13 @@ TREEVIEW_LButtonDown(TREEVIEW_INFO *infoPtr, LPARAM lParam) bTrack = (ht.flags & TVHT_ONITEM) && !(infoPtr->dwStyle & TVS_DISABLEDRAGDROP); + /* + * If the style allows editing and the node is already selected + * and the click occurred on the item label... + */ + bDoLabelEdit = (infoPtr->dwStyle & TVS_EDITLABELS) && + (ht.flags & TVHT_ONITEMLABEL) && (infoPtr->selectedItem == ht.hItem); + /* Send NM_CLICK right away */ if (!bTrack) if (TREEVIEW_SendSimpleNotify(infoPtr, NM_CLICK)) @@ -3890,12 +3897,7 @@ TREEVIEW_LButtonDown(TREEVIEW_INFO *infoPtr, LPARAM lParam) if (bTrack && TREEVIEW_SendSimpleNotify(infoPtr, NM_CLICK)) goto setfocus; - /* - * If the style allows editing and the node is already selected - * and the click occurred on the item label... - */ - if ((infoPtr->dwStyle & TVS_EDITLABELS) && - (ht.flags & TVHT_ONITEMLABEL) && (infoPtr->selectedItem == ht.hItem)) + if (bDoLabelEdit) { if (infoPtr->Timer & TV_EDIT_TIMER_SET) KillTimer(hwnd, TV_EDIT_TIMER);