View Issue Details

IDProjectCategoryView StatusLast Update
0034627LazarusLCLpublic2018-12-02 10:13
ReporterOndrej Pokorny Assigned ToZeljan Rikalo  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Summary0034627: Wrong treeview tooltip hint position after #34461 / r34461
DescriptionAfter 0034461 / r34461 the hint position is wrong in the treeview - it is shifted 1px to the right.
Steps To ReproduceSee the attached project. Place mouse cursor above the treeview item. The hint window is shifted 1px to the right.
TagsNo tags attached.
Fixed in Revision
LazTarget-
WidgetsetWin32/Win64
Attached Files

Relationships

related to 0034461 closedZeljan Rikalo Patches TreeItem text is centered instead of left justified 

Activities

Ondrej Pokorny

2018-12-01 15:36

developer  

TreeViewToolTip.zip (2,176 bytes)

Zeljan Rikalo

2018-12-01 17:32

developer   ~0112300

It is regression after r59647

Ondrej Pokorny

2018-12-01 17:36

developer   ~0112303

Yes, it is a regression after r59647 - sorry, I got the revision number wrong in the description. It should read r59647.

Zeljan Rikalo

2018-12-01 18:12

developer  

issue34627.diff (819 bytes)   
Index: lcl/include/treeview.inc
===================================================================
--- lcl/include/treeview.inc	(revision 59709)
+++ lcl/include/treeview.inc	(working copy)
@@ -1747,7 +1747,7 @@
   Result := DisplayTextLeft;
   TV := TreeView;
   if TV <> nil then
-    Inc(Result, TV.Canvas.TextWidth(Text) + TV.Indent div 2);
+    Inc(Result, TV.Canvas.TextWidth(Text) + (TV.FDefItemSpace * 2){TV.Indent div 2});
 end;
 
 function TTreeNode.AlphaSort: Boolean;
@@ -5237,7 +5237,8 @@
         Canvas.Font.Color := FHotTrackColor;
     end;
 
-    NodeRect.Offset(ScaleX(2, 96), 0);
+    OffsetRect(NodeRect, FDefItemSpace, 0);
+
     if (tvoThemedDraw in Options) then
       ThemeServices.DrawText(Canvas, Details, AText, NodeRect, DT_LEFT or DT_VCENTER or DT_SINGLELINE or DT_NOPREFIX, 0)
     else
issue34627.diff (819 bytes)   

Zeljan Rikalo

2018-12-01 18:12

developer   ~0112306

Please test with attached patch. I cannot test on real windows machine, but under linux and wine it looks correct now.

Ondrej Pokorny

2018-12-01 20:34

developer   ~0112309

Thank you. It didn't help on Windows at 96PPI. I'll test on different PPI settings and Linux in the next days.

Zeljan Rikalo

2018-12-02 10:13

developer   ~0112312

Wait, you're talking about Hint window position, not about position of text inside hint window ?

Issue History

Date Modified Username Field Change
2018-12-01 15:36 Ondrej Pokorny New Issue
2018-12-01 15:36 Ondrej Pokorny File Added: TreeViewToolTip.zip
2018-12-01 17:32 Zeljan Rikalo Note Added: 0112300
2018-12-01 17:36 Ondrej Pokorny Note Added: 0112303
2018-12-01 17:52 Zeljan Rikalo Relationship added related to 0034461
2018-12-01 18:12 Zeljan Rikalo File Added: issue34627.diff
2018-12-01 18:12 Zeljan Rikalo LazTarget => -
2018-12-01 18:12 Zeljan Rikalo Note Added: 0112306
2018-12-01 18:12 Zeljan Rikalo Assigned To => Zeljan Rikalo
2018-12-01 18:12 Zeljan Rikalo Status new => feedback
2018-12-01 20:34 Ondrej Pokorny Note Added: 0112309
2018-12-01 20:34 Ondrej Pokorny Status feedback => assigned
2018-12-02 10:13 Zeljan Rikalo Note Added: 0112312