mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-21 15:49:24 +01:00
LCL: Improve TreeView Tooltip support. Issue #28879, patch from Alexey.
git-svn-id: trunk@50248 -
This commit is contained in:
parent
89738efcb7
commit
06a2f78e3c
@ -4224,7 +4224,6 @@ var
|
||||
Node: TTreeNode;
|
||||
P: TPoint;
|
||||
R: TRect;
|
||||
OffsetLeft: integer;
|
||||
SText: string;
|
||||
begin
|
||||
if FHintWnd=nil then
|
||||
@ -4237,28 +4236,19 @@ begin
|
||||
exit;
|
||||
end;
|
||||
|
||||
SText:=Node.Text;
|
||||
OffsetLeft:=(Node.Level+1)*16 + 2;
|
||||
//seems each level gives indent of 16pix
|
||||
//this needs dec for ShowRoot=false, but i cannot guess, by 16pix?
|
||||
|
||||
if Assigned(FImages) then
|
||||
if (not Node.Selected and (Node.ImageIndex>=0)) or
|
||||
(Node.Selected and (Node.SelectedIndex>=0)) then
|
||||
Inc(OffsetLeft, FImages.Width);
|
||||
|
||||
Canvas.Font.Assign(Self.Font);
|
||||
if Canvas.TextWidth(SText)+OffsetLeft < ClientWidth then
|
||||
//DisplayTextRight is increased by Indent/2 for l/r sides
|
||||
if Node.DisplayTextRight - Indent div 4 < ClientWidth then
|
||||
begin
|
||||
FHintWnd.Hide;
|
||||
exit;
|
||||
end;
|
||||
|
||||
SText:=Node.Text;
|
||||
R:=FHintWnd.CalcHintRect(cMaxHintWidth, SText, nil);
|
||||
|
||||
//show hint at edge of control, to not overlap node, to allow click node,
|
||||
//also hint fontsize <> control fontsize
|
||||
P:=Point(ClientWidth, Node.Top);
|
||||
P:=Point(ClientWidth, Node.Top-ScrolledTop);
|
||||
P:=ClientToScreen(P);
|
||||
OffsetRect(R, P.X, P.Y);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user