lcl: treeview: fix tooltip hiding

git-svn-id: trunk@52362 -
This commit is contained in:
ondrej 2016-05-23 15:28:19 +00:00
parent 4c522305c1
commit f68cca0ca9
2 changed files with 12 additions and 1 deletions

View File

@ -3298,6 +3298,7 @@ type
function GetShowSeparators: boolean; function GetShowSeparators: boolean;
function GetToolTips: boolean; function GetToolTips: boolean;
function GetTopItem: TTreeNode; function GetTopItem: TTreeNode;
procedure HintMouseLeave(Sender: TObject);
procedure ImageListChange(Sender: TObject); procedure ImageListChange(Sender: TObject);
procedure OnChangeTimer(Sender: TObject); procedure OnChangeTimer(Sender: TObject);
procedure SetAutoExpand(Value: Boolean); procedure SetAutoExpand(Value: Boolean);

View File

@ -4128,6 +4128,12 @@ begin
Result := FTopItem; Result := FTopItem;
end; end;
procedure TCustomTreeView.HintMouseLeave(Sender: TObject);
begin
if FindLCLControl(Mouse.CursorPos)<>Self then
FHintWnd.Hide;
end;
procedure TCustomTreeView.SetTopItem(Value: TTreeNode); procedure TCustomTreeView.SetTopItem(Value: TTreeNode);
begin begin
if HandleAllocated and (Value <> nil) then if HandleAllocated and (Value <> nil) then
@ -4235,7 +4241,10 @@ var
MaxHintWidth: Integer; MaxHintWidth: Integer;
begin begin
if FHintWnd=nil then if FHintWnd=nil then
begin
FHintWnd:=THintWindow.Create(Self); FHintWnd:=THintWindow.Create(Self);
FHintWnd.OnMouseLeave:=@HintMouseLeave;
end;
Node:=GetNodeAt(X, Y); Node:=GetNodeAt(X, Y);
if Node=nil then if Node=nil then
@ -5528,7 +5537,8 @@ procedure TCustomTreeView.MouseLeave;
begin begin
FStates:=FStates-[tvsDblClicked,tvsTripleClicked,tvsQuadClicked, FStates:=FStates-[tvsDblClicked,tvsTripleClicked,tvsQuadClicked,
tvsEditOnMouseUp,tvsSingleSelectOnMouseUp]; tvsEditOnMouseUp,tvsSingleSelectOnMouseUp];
if Assigned(FHintWnd) then if Assigned(FHintWnd) and FHintWnd.Visible
and not PtInRect(ClientRect, ScreenToClient(Mouse.CursorPos)) then
FHintWnd.Hide; FHintWnd.Hide;
inherited MouseLeave; inherited MouseLeave;
end; end;