Determine whether to do label edit before sending NM_CLICK.

This commit is contained in:
Robert Shearman 2004-09-28 19:17:17 +00:00 committed by Alexandre Julliard
parent 02e850efdf
commit 847c81df89
1 changed files with 9 additions and 7 deletions

View File

@ -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);