diff --git a/Source/VirtualTrees.Header.pas b/Source/VirtualTrees.Header.pas index 641190b8..8b04190d 100644 --- a/Source/VirtualTrees.Header.pas +++ b/Source/VirtualTrees.Header.pas @@ -333,6 +333,7 @@ TVTHeader = class(TPersistent) FDragImage : TVTDragImage; //drag image management during header drag FLastWidth : TDimension; //Used to adjust spring columns. This is the width of all visible columns, not the header rectangle. FRestoreSelectionColumnIndex : Integer; //The column that is used to implement the coRestoreSelection option + FWasDoubleClick : Boolean; // The previous mouse message was for a double click, that allows us to process mouse-up-messages differently function GetMainColumn : TColumnIndex; function GetUseColumns : Boolean; function IsFontStored : Boolean; @@ -1520,9 +1521,11 @@ function TVTHeader.HandleMessage(var Message : TMessage) : Boolean; CheckBoxHit := False; end; end; + fWasDoubleClick := False; end; WM_LBUTTONDBLCLK, WM_NCLBUTTONDBLCLK, WM_NCMBUTTONDBLCLK, WM_NCRBUTTONDBLCLK : begin + fWasDoubleClick := True; if Message.Msg <> WM_LBUTTONDBLCLK then with TWMNCLButtonDblClk(Message) do P := FOwner.ScreenToClient(Point(XCursor, YCursor)) @@ -1664,6 +1667,7 @@ function TVTHeader.HandleMessage(var Message : TMessage) : Boolean; HandleMessage := TVirtualTreeColumnsCracker(FColumns).HandleClick(P, TMouseButton.mbRight, True, False); TBaseVirtualTreeCracker(FOwner).DoHeaderMouseUp(TMouseButton.mbRight, GetShiftState, P.X, P.Y + FHeight); end; + fWasDoubleClick := False; end; //When the tree window has an active mouse capture then we only get "client-area" messages. WM_LBUTTONUP, WM_NCLBUTTONUP : @@ -1729,6 +1733,7 @@ function TVTHeader.HandleMessage(var Message : TMessage) : Boolean; end; Result := True; Message.Result := 0; + fWasDoubleClick := False; end; case Message.Msg of @@ -1742,14 +1747,17 @@ function TVTHeader.HandleMessage(var Message : TMessage) : Boolean; end; if FStates <> [] then TBaseVirtualTreeCracker(FOwner).DoHeaderMouseUp(TMouseButton.mbLeft, KeysToShiftState(Keys), XPos, YPos); + fWasDoubleClick := False; end; WM_NCLBUTTONUP : begin with TWMNCLButtonUp(Message) do P := FOwner.ScreenToClient(Point(XCursor, YCursor)); - TVirtualTreeColumnsCracker(FColumns).HandleClick(P, TMouseButton.mbLeft, True, False); + if not fWasDoubleClick then + TVirtualTreeColumnsCracker(FColumns).HandleClick(P, TMouseButton.mbLeft, True, False); TBaseVirtualTreeCracker(FOwner).DoHeaderMouseUp(TMouseButton.mbLeft, GetShiftState, P.X, P.Y + FHeight); Result := True; + fWasDoubleClick := False; end; end;