Missing line in ShowHint lazarus / 31-LCL ---------------------------------------------------------------------- jipété · 2024-06-07 07:58 Hello, I configure a TRadioGroup with 11 items, as one can see on screenshot attached. But the ShowHint function displays only the first 10 lines. Thanks to tell me what can I do. Linux-Debian 11.9 Gtk2 FPC 3.2.2 Laz 3.2 ---------------------------------------------------------------------- Thaddy · 2024-06-07 08:38 I would simply give the hint explanation on an item by item base. ---------------------------------------------------------------------- jipété · 2024-06-07 09:20 Quote from: Thaddy on June 07, 2024, 10:38:25 amI would simply give the hint explanation on an item by item base. So I break the RadioGroup in 11 elements ? Not fun... In the meantime I've found a way to have my 11 items together (so easy to compare) : I simply add an empty new line, and I add 5 spaces on that line. Maybe 4 or 3 is enough, not tested. But I dunno why I lose the possibility to enter the Hint form for, for example, make a copy-paste from some lines to elsewhere. ---------------------------------------------------------------------- Thaddy · 2024-06-07 09:52 It is not fun for the programmer, but better for the user: a tooltip is not meant to show a whole manual. ---------------------------------------------------------------------- jipété · 2024-06-07 13:55 Quote from: Thaddy on June 07, 2024, 11:52:40 ama tooltip is not meant to show a whole manual. Not a whole manual, but just a little list to allow comparaisons, each item followed by a few text to explain. Because if we see them one at a time, as soon as the 2 is displayed, the 1 is forgotten and we don't know what will appear next. The comparison is then really difficult. It must be taken into account that if there had been 1 to 8 types of filters, we would not be here discussing it because the hintbox is then well filled, and without empty lines. It is from the 9th entry that the last line is no longer visible, unless I add spaces (minimum 2, if only 1 there are interference problems with the image on the right side [not shown here]...) The interferences are the image size not being correct (missing top) and the repainting not being complete, as if the memory was corrupted. ---------------------------------------------------------------------- jamie · 2024-06-07 21:17 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormCreate(Sender: TObject);var  C:Tcontrol;begin  With RadioGroup1 do    Begin      Controls[0].Hint := 'Box Equivalent ---';      Controls[1].Hint := 'Linear Linear interpolation....';    Controls[2].Hint := 'HalfCosine Mix of Linear ....';      //And so on.      Hint := 'Fill In the rest yourself!';    end; end;                                           With that you can at least fill in the hints per item. ---------------------------------------------------------------------- jipété · 2024-06-07 22:06 Quote from: jamie on June 07, 2024, 11:17:10 pmWith that you can at least fill in the hints per item. ??? I have the hints per item or better, one item one hint 11 times and bingo (except the empty line on bottom of the HintWindow) Like that I can read all items and the choice is easy, like in a restaurant and its menu: you read here, you read there, it's not a dish at a time, then you compare and you choose. New screenshot with the tip for displaying full count of lines : ---------------------------------------------------------------------- jamie · 2024-06-08 00:12 Guess you will need to subclass the THintWindow with your class and override the limited behavior.  Of it takes a few steps to do that ---------------------------------------------------------------------- jipété · 2024-06-08 06:10 Hello, Quote from: jamie on June 08, 2024, 02:12:45 am... and override the limited behavior. Yesterday I searched in the LCL and I found nothing about the number of lines and the height of the window. And yet, there are very large displays: test for example with the mouse on ClientWidth or better, Caption, which displays a large book page with empty lines, code examples, colored lines, etc. EDIT: I just discovered another discussion about hints, here, a few lines below mine (https://forum.lazarus.freepascal.org/index.php/topic ,67473.msg519260.html#msg519260), and this is what I found, depending on whether or not I comment on the last line of RadioGroup1.Items.Text (plus the presence or absence of the semicolon, of course): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormActivate(Sender: TObject);begin  RadioGroup1.Items.Text := 'Item 1' + LineEnding + 'Item 2' + LineEnding + 'Item 3'    + LineEnding + 'Item 4' + LineEnding + 'Item 5' + LineEnding + 'Item 6'    + LineEnding + 'Item 7' + LineEnding + 'Item 8'    + LineEnding + 'Item 9' + LineEnding + 'Item 10' + LineEnding + 'Item 11';  RadioGroup1.ShowHint := True;  RadioGroup1.Hint := RadioGroup1.Items.Text;end;/EDIT Have a nice day, ---------------------------------------------------------------------- paweld · 2024-06-08 07:21 RadioGroup1.Items.Text contains an extra end-of-line character at the end - remove it and it will be ok:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i RadioGroup1.Hint := TrimRight(RadioGroup1.Items.Text); ---------------------------------------------------------------------- jipété · 2024-06-08 07:29 Quote from: paweld on June 08, 2024, 09:21:42 amRadioGroup1.Items.Text contains an extra end-of-line character at the end - remove it and it will be ok:No. Adding your line gives me the exact same window as the one I've tagged BAD in my previous screenshot... What is your OS ? Windows ? Mine is Linux-Debian. ---------------------------------------------------------------------- paweld · 2024-06-08 08:34 Tested on Windows 10 i Debian 12 - Lazarus trunk, FPC fixes. It could also be that the width of the prompts is miscalculated on your system, try this code then:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls; type   { TCustomHintWindow }   TCustomHintWindow = class(THintWindow)  private    function CalcHintRect(MaxWidth: Integer; const AHint: string; AData: Pointer): TRect; override;  end;   { TForm1 }   TForm1 = class(TForm)    RadioGroup1: TRadioGroup;    procedure FormActivate(Sender: TObject);    procedure FormCreate(Sender: TObject);  private   public   end; var  Form1: TForm1; implementation {$R *.lfm} { TCustomHintWindow } function TCustomHintWindow.CalcHintRect(MaxWidth: Integer; const AHint: string; AData: Pointer): TRect;var  tmpHint: String;begin  tmpHint := TrimRight(AHint);  Result := inherited CalcHintRect(MaxWidth, tmpHint, AData);  if tmpHint <> '' then    Inc(Result.Right, 8);end; { TForm1 } procedure TForm1.FormActivate(Sender: TObject);begin  RadioGroup1.Items.Text := 'Item 1' + LineEnding + 'Item 2' + LineEnding + 'Item 3'    + LineEnding + 'Item 4' + LineEnding + 'Item 5' + LineEnding + 'Item 6'    + LineEnding + 'Item 7' + LineEnding + 'Item 8'    + LineEnding + 'Item 9' + LineEnding + 'Item 10' + LineEnding + 'Item 11';  RadioGroup1.ShowHint := True;  RadioGroup1.Hint := RadioGroup1.Items.Text;end; procedure TForm1.FormCreate(Sender: TObject);begin  HintWindowClass := TCustomHintWindow;end; end. ---------------------------------------------------------------------- jipété · 2024-06-08 08:48 Quote from: paweld on June 08, 2024, 10:34:21 amIt could also be that the width of the prompts is miscalculated on your system, try this code then Sorry to tell you that the result is still bad : empty last line... I'll wait for Debian 12 and/or the FPC fixes + Laz 3.4. Thanks, ---------------------------------------------------------------------- jamie · 2024-06-08 14:58 I guess the question is, are you missing a line, or do you have an additional line? If it's an additional line, then I would suggest you study the source of your string and ensure you don't have a CR/LF at the end of the line.  I can in fact simulate that simply by adding a blank line in the string editor.  So, what is it? Missing the last line or an extra blank line? ---------------------------------------------------------------------- jipété · 2024-06-08 18:10 Okay, the story: I want to use the ReSampleFilters, there are 11 of them there, in BGRABitmapTypes line 587 and following:  Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {* List of resample filter to be used with _rmFineResample_ }  TResampleFilter = (    {** Equivalent of simple stretch with high quality and pixel- centered coordinates }    rfBox,    {** Linear interpolation giving slow transition between pixels }    rfLinear,    {** Mix of _rfLinear_ and _rfCosine_ giving medium speed stransition between pixels }    rfHalfCosine,    {** Cosine-like interpolation giving fast transition between pixels }    rfCosine,    {** Simple bi-cubic filter (blurry) }    rfBicubic,    {** Mitchell filter, good for downsizing interpolation }    rfMitchell,    {** Spline filter, good for upsizing interpolation, however slightly blurry }    rfSpline,    {** Lanczos with radius 2, blur is corrected }    rfLanczos2,    {** Lanczos with radius 3, high contrast }    rfLanczos3,    {** Lanczos with radius 4, high contrast }    rfLanczos4,    {** Best quality using rfMitchell or rfSpline }    rfBestQuality); And since I'm going to use a RadioGroup to choose 1 out of 11 and I'm not a specialist in these filters, I thought that a tooltip showing me the appropriate texts (in parentheses above) would do the trick. And if I don't exceed 8 filters it works well. As soon as I go to 9 it's a disaster, the last line, which is present in the .lfm, is not displayed. Unless I add spaces at the end, which has the side effect of adding an empty line. Extracted from .lfm : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     object rdgResFilters: TRadioGroup      ...      Hint = 'Box          Equivalent of simple stretch with high quality and pixel-centered coordinates'#10'Linear       Linear interpolation giving slow transition between pixels'#10'HalfCosine   Mix of Linear and Cosine giving medium speed transition between pixels'#10'Cosine       Cosine- like interpolation giving fast transition between pixels'#10'Bicubic    Simple bi-cubic filter (blurry)'#10'Mitchell     Good for downsizing interpolation'#10'Spline       Good for upsizing interpolation, however slightly blurry'#10'Lanczos2     Lanczos with radius 2, blur is corrected'#10'Lanczos3     Lanczos with radius 3, high contrast'#10'Lanczos4     Lanczos with radius 4, high contrast'#10'BestQuality  Best quality using Mitchell or Spline'#10'  '      ...      Items.Strings = (        'Box          Equivalent of simple stretch with high quality and pixel-centered coordinates'      'Linear       Linear interpolation giving slow transition between pixels'        'HalfCosine   Mix of Linear and Cosine giving medium speed transition between pixels'        'Cosine       Cosine-like interpolation giving fast transition between pixels'        'Bicubic    Simple bi-cubic filter (blurry)'        'Mitchell     Good for downsizing interpolation'        'Spline       Good for upsizing interpolation, however slightly blurry'        'Lanczos2     Lanczos with radius 2, blur is corrected'        'Lanczos3     Lanczos with radius 3, high contrast'        'Lanczos4     Lanczos with radius 4, high contrast'        'BestQuality  Best quality using Mitchell or Spline'      )      ...    end The last characters after ...Spline' at the end of the section "Hint" are those that allow the last hint to be visible in the HintWindow. Regards, ---------------------------------------------------------------------- Josh · 2024-06-08 19:06 just done a test with hint of tbutton with your text (moded) displays fine, changed hint font to a mono font ---------------------------------------------------------------------- dsiders · 2024-06-08 22:43 Quote from: Josh on June 08, 2024, 09:06:52 pmjust done a test with hint of tbutton with your text (moded) displays fine, changed hint font to a mono font So far, the only thing we don;t know is what weird WM/DE/Theme combination the OP is using. ---------------------------------------------------------------------- jipété · 2024-06-09 06:38 Hello, Quote from: Josh on June 08, 2024, 09:06:52 pmjust done a test with hint of tbutton with your text (moded) displays fine, changed hint font to a mono font Glad for you to have a perfect result. Just one question: what operating system and what versions of FPC and Lazarus? Quote from: dsiders on June 09, 2024, 12:43:48 amSo far, the only thing we don't know is what weird WM/DE/Theme combination the OP is using. WM/DE = Debian-OpenBox-LXDE, no theme used. Have a nice day, ---------------------------------------------------------------------- jamie · 2024-06-09 18:54 Are you using SHORT strings in your code ? ---------------------------------------------------------------------- jipété · 2024-06-09 21:33 Quote from: jamie on June 09, 2024, 08:54:14 pmAre you using SHORT strings in your code ? No. No code is used for displaying the Hint Window : I fill the Project Inspector by Copy/Paste with the values found in BGRABitmapType and one can read, in the bottom of the Project Inspector when the Hint property is selected, "Hint is a TTranslateString property with hint text displayed in a pop-up window when the mouse is hovered over the control..." One more time, the content of my .lfm, section RadioGroup : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     object rdgResFilters: TRadioGroup      ...      Hint = 'Box          Equivalent of simple stretch with high quality and pixel-centered coordinates'#10'Linear       Linear interpolation giving slow transition between pixels'#10'HalfCosine   Mix of Linear and Cosine giving medium speed transition between pixels'#10'Cosine       Cosine- like interpolation giving fast transition between pixels'#10'Bicubic    Simple bi-cubic filter (blurry)'#10'Mitchell     Good for downsizing interpolation'#10'Spline       Good for upsizing interpolation, however slightly blurry'#10'Lanczos2     Lanczos with radius 2, blur is corrected'#10'Lanczos3     Lanczos with radius 3, high contrast'#10'Lanczos4     Lanczos with radius 4, high contrast'#10'BestQuality  Best quality using Mitchell or Spline'#10'  '      ...      Items.Strings = (        'Box          Equivalent of simple stretch with high quality and pixel-centered coordinates'      'Linear       Linear interpolation giving slow transition between pixels'        'HalfCosine   Mix of Linear and Cosine giving medium speed transition between pixels'        'Cosine       Cosine-like interpolation giving fast transition between pixels'        'Bicubic    Simple bi-cubic filter (blurry)'        'Mitchell     Good for downsizing interpolation'        'Spline       Good for upsizing interpolation, however slightly blurry'        'Lanczos2     Lanczos with radius 2, blur is corrected'        'Lanczos3     Lanczos with radius 3, high contrast'        'Lanczos4     Lanczos with radius 4, high contrast'        'BestQuality  Best quality using Mitchell or Spline'      )      ...    end And again, the 8 characters following the words Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 'BestQuality  Best quality using Mitchell or Spline', " #10'  ' ", are added by me so I can read the last sentence. If I don't add them, no last sentence is visible, the HintWindow ends up with Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 'Lanczos4   Lanczos with radius 4, high contrast', followed by an empty line. To avoid it, I must limit the number of lines to 8, but doing that, I loose 3 hints, not fun... ---------------------------------------------------------------------- jamie · 2024-06-09 21:50 have you implemented the "OnShowHint" event, so you can examine the last line of the text ?  It appears you are on a nix and from what little I know about them, they use only a #10 as new line characters.  It could also be the last line in the hint text has a LineFeed/CR trailing at the end.  But you can see all of this if you examine the string during the OnShowHint event. ---------------------------------------------------------------------- jipété · 2024-06-09 22:37 Quote from: jamie on June 09, 2024, 11:50:37 pmhave you implemented the "OnShowHint" event, so you can examine the last line of the text ?No. I didn't know that. Quote from: jamie on June 09, 2024, 11:50:37 pm It appears you are on a nix and from what little I know about them, they use only a #10 as new line characters. Yes yes. But if I only have 8 items or less, EVERYTHING WORKS FINE. Quote from: jamie on June 09, 2024, 11:50:37 pm It could also be the last line in the hint text has a LineFeed/CR trailing at the end. No. Look at the screenshot below (end of the long hints' line in .lfm posted in my last post). Quote from: jamie on June 09, 2024, 11:50:37 pm But you can see all of this if you examine the string during the OnShowHint event. Dunno what to ask here : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormShowHint(Sender: TObject; HintInfo: PHintInfo);begin  ???????????????end; ---------------------------------------------------------------------- jamie · 2024-06-09 23:42 I don't care what the lfm file holds. PHintInfo^.hintstr holds the string that is going to be displayed. You need to examine that one. make a reference to it so the debugger can stop and show you the contents. ---------------------------------------------------------------------- jipété · 2024-06-10 04:32 Hello, Quote from: jamie on June 10, 2024, 01:42:57 amPHintInfo^.hintstr holds the string that is going to be displayed. make a reference to it... First time in my life that someone asks me to do that. I don't know what you want, I don't understand what you mean... Tried the following (see screenshot) but compiler not happy. ---------------------------------------------------------------------- cdbc · 2024-06-10 04:35 Hi The variable HintInfo IS a PHintInfo...! So, try with Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i S:= HintInfo^.hintstr;Regards Benny ---------------------------------------------------------------------- jipété · 2024-06-10 04:45 Ok, so I tried the following : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormShowHint(Sender: TObject; HintInfo: PHintInfo);var s: string;begin  s := HintInfo^.HintStr;  // <--- the breakpoint here  memo1.Append(s);end; and nothing is displayed in the memo, after a MouseMove on the radiogroup... EDIT : If I add a Breakpoint on line 4 above, a MouseMove over the radiogroup shows the HintWindow but doesn't break the flow of instructions...