[Lazarus] Show value hints while debugging fills screen - patch

Russ russeld.lists at gmail.com
Tue May 23 12:35:36 CEST 2017


I find debugging value hints (TurboPowerIProDsgn installed, "Show value 
hints while debugging") useful but annoying when the hint becomes so big 
it covers the variable being checked or even fills the screen; on single 
monitor systems the only way to close the hint is to scroll down to the 
variable link. Especially annoying when the mouse-over was inadvertent.

The following code illustrates the problem:
<code>
program HugeHintProblem;
var
   HugeHintVar: array[1..100, 1..100] of byte;
   i, j: Integer;
begin
   for i := 1 to 100 do
     for j := 1 to 100 do
       HugeHintVar[i,j] := random(255);
  { Break on  the next statement and mouse-over HugeHintVar - The hint 
will fill the screen (this may take some time).}
   HugeHintVar[1, 1] := 56;
  end.
</code>

The following patch seems to fix the problem, limiting the hint span 
from the left side of the variable and one line below to the bottom 
right corner of the editor in undocked mode, and to the bottom right 
corner of the IDE in docked mode.

<patch>
Index: components/ideintf/idehelpintf.pas
===================================================================
--- components/ideintf/idehelpintf.pas    (revision 55056)
+++ components/ideintf/idehelpintf.pas    (working copy)
@@ -383,6 +383,8 @@
    end;

    procedure DoHtml;
+  var
+    MaxWidth, MaxHeight: Integer;
    begin
      if HintFont<>nil then
        HintRenderWindow.Font := HintFont;
@@ -397,10 +399,16 @@
        ms.Free;
      end;
HtmlHelpProvider.ControlIntf.GetPreferredControlSize(NewWidth,NewHeight);
+    MaxWidth := Screen.ActiveForm.Left + Screen.ActiveForm.Width - 
ScreenPos.x;
+    MaxHeight := Screen.ActiveForm.Top + Screen.ActiveForm.Height - 
ScreenPos.y;
      if NewWidth <= 0 then
-      NewWidth := 500;
+      NewWidth := 500
+    else if NewWidth > MaxWidth then
+      NewWidth := MaxWidth;
      if NewHeight <= 0 then
-      NewHeight := 200;
+      NewHeight := 200
+    else if NewHeight > MaxHeight then
+      NewHeight := MaxHeight;
      HintRenderWindow.HintRectAdjust := Rect(0, 0, NewWidth, NewHeight);
      if MouseOffset then
        HintRenderWindow.OffsetHintRect(ScreenPos)
</patch>

I have tested this with windows XP, 7 and 8.1, Lazarus V1.64, V1.65 and 
trunk, and with two monitors in various configurations

I tried to register an account on the bug tracker twice, but the link in 
the confirmation email leads to an APPLICATION ERROR #1902 in Mantis, 
complaining about an invalid confirmation URL

Regards
Russell

---
This email has been checked for viruses by AVG.
http://www.avg.com



More information about the Lazarus mailing list