diff --git a/lcl/comctrls.pp b/lcl/comctrls.pp index 8949b4ba92..ec4bb9e65e 100644 --- a/lcl/comctrls.pp +++ b/lcl/comctrls.pp @@ -3298,6 +3298,7 @@ type function GetShowSeparators: boolean; function GetToolTips: boolean; function GetTopItem: TTreeNode; + procedure HintMouseLeave(Sender: TObject); procedure ImageListChange(Sender: TObject); procedure OnChangeTimer(Sender: TObject); procedure SetAutoExpand(Value: Boolean); diff --git a/lcl/include/treeview.inc b/lcl/include/treeview.inc index e1cc9a96c5..e41013b358 100644 --- a/lcl/include/treeview.inc +++ b/lcl/include/treeview.inc @@ -4128,6 +4128,12 @@ begin Result := FTopItem; end; +procedure TCustomTreeView.HintMouseLeave(Sender: TObject); +begin + if FindLCLControl(Mouse.CursorPos)<>Self then + FHintWnd.Hide; +end; + procedure TCustomTreeView.SetTopItem(Value: TTreeNode); begin if HandleAllocated and (Value <> nil) then @@ -4235,7 +4241,10 @@ var MaxHintWidth: Integer; begin if FHintWnd=nil then + begin FHintWnd:=THintWindow.Create(Self); + FHintWnd.OnMouseLeave:=@HintMouseLeave; + end; Node:=GetNodeAt(X, Y); if Node=nil then @@ -5528,7 +5537,8 @@ procedure TCustomTreeView.MouseLeave; begin FStates:=FStates-[tvsDblClicked,tvsTripleClicked,tvsQuadClicked, tvsEditOnMouseUp,tvsSingleSelectOnMouseUp]; - if Assigned(FHintWnd) then + if Assigned(FHintWnd) and FHintWnd.Visible + and not PtInRect(ClientRect, ScreenToClient(Mouse.CursorPos)) then FHintWnd.Hide; inherited MouseLeave; end;