Hints. lazarus / 61-Beginners ---------------------------------------------------------------------- seghele0 · 2024-09-11 12:52 The code below works in FormCreate, so all hints on the form have these specific settings. Is it possible to do this individually for different buttons, each with their own Hint setting. 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 In FormCreate: // Making special fontsize and color for HINT Screen.HintFont.Size:= 18; Screen.HintFont.Style:= [fsBold]; Screen.HintFont.Color:= clYellow; Application.HintColor:= clBlack; ---------------------------------------------------------------------- wp · 2024-09-11 13:17 You could try to set the specific hint properties in the OnMouseEnter event handler of these controls, and reset them in OnMouseLeave. ---------------------------------------------------------------------- seghele0 · 2024-09-11 15:29 I was able to get an example, but it doesn't work yet. I keep getting an ERROR: HintWindow identifier not found. Hopefully someone can give me the solution 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+}interfaceuses   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, LCLType;type  { TMainForm }  TMainForm = class(TForm)    Button1: TButton;    Button2: TButton;    procedure FormCreate(Sender: TObject);    procedure OnHintHandler(Sender: TObject);  private  public  end;var  MainForm: TMainForm;implementation{$R *.lfm}{ TMainForm } procedure TMainForm.FormCreate(Sender: TObject);begin  Button1.Hint := 'Hint (Yellow - Black)';  Button2.Hint := 'Hint (Blue - White)';  Button1.ShowHint := True;  Button2.ShowHint := True;  Application.OnShowHint := @OnHintHandler;end; procedure TMainForm.OnHintHandler(Sender: TObject);begin  if (HintWindow.HintControl = Button1) then  begin    Application.HintColor := clBlack;    Application.HintFont.Color := clYellow;  end  else if (HintWindow.HintControl = Button2) then  begin    Application.HintColor := clWhite;    Application.HintFont.Color := clBlue;  end;end. ---------------------------------------------------------------------- wp · 2024-09-11 16:03 Not 100%, because the hint's font keeps the color of the first control hit. But at least it compiles and changes the hint's background color: 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 TMainForm.OnHintHandler(var HintStr: string; var CanShow: Boolean;    var HintInfo: THintInfo);begin  if (HintInfo.HintControl = Button1) then  begin    Screen.HintFont.Color := clBlack;    HintInfo.HintColor := clYellow;  end  else if (HintInfo.HintControl = Button2) then  begin    Screen.HintFont.Color := clWhite;    HintInfo.HintColor := clBlue;  end;end; ---------------------------------------------------------------------- seghele0 · 2024-09-12 08:44 Thanks for the response. Sorry, but it doesn't work with your code either. I get ERROR. 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+}interfaceuses   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, LCLType;type  { TMainForm }  TMainForm = class(TForm)    Button1: TButton;    Button2: TButton;    procedure FormCreate(Sender: TObject);    procedure OnHintHandler(var Hintstr: string; var CanShow: Boolean);  private  public  end;var  MainForm: TMainForm; implementation{$R *.lfm}{ TMainForm } procedure TMainForm.FormCreate(Sender: TObject);begin  Button1.Hint := 'Hint (Yellow - Black)';  Button2.Hint := 'Hint (Blue - White)';  Button1.ShowHint := True;  Button2.ShowHint := True;  Application.OnShowHint := @OnHintHandler;end; procedure TMainForm.OnHintHandler(var Hintstr: string; var CanShow: Boolean);var   HintInfo: THintInfo;begin   if HintInfo.HintControl = Button1) then   begin       Screen.HintFont.Color := clBlack;       HintInfo.HintColor := clYellow;   end   else if (HintInfo.HintControl = Button2) then   begin      Screen.HintFont.Color := clWhite;      HintInfo.HintColor := clBlue;   end;end. ---------------------------------------------------------------------- wp · 2024-09-12 09:14 Look carefully at my code: var HintInfo: THintInfo is not a local variable but an argument of the OnHintHandler procedure (just wrapped into a separate line)The final "end;" of the procedure is missing.There are some strange characters in front of some lines. Delete them so that the compiler accepts the code.Copy & paste this into your code: 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 TMainForm.OnHintHandler(var Hintstr: string; var CanShow: Boolean;  var HintInfo: THintInfo);begin  if (HintInfo.HintControl = Button1) then  begin    Screen.HintFont.Color := clBlack;    HintInfo.HintColor := clYellow;  end  else if (HintInfo.HintControl = Button2) then  begin    Screen.HintFont.Color := clWhite;    HintInfo.HintColor := clBlue;  end;end; ---------------------------------------------------------------------- seghele0 · 2024-09-12 09:38 Sorry, sorry, but I don't get it. I have done copy/paste of the procedure, but still ERRORS. Would it be possible to send your full working version in a ZIP? ---------------------------------------------------------------------- rvk · 2024-09-12 09:42 Quote from: seghele0 on September 12, 2024, 11:38:50 amI have done copy/paste of the procedure, but still ERRORS. Then show your code after copy/paste. You are doing something wrong... (And it's best to find that in your own code so you can learn  ) The OnHintHandler from Application class needs to have a certain structure/parameters. The HintWindow is passed there as parameter. You defined it as local variable. Don't do that. So if you show your code, we can see if you fixed that. Also... always provide the error-text itself (which you didn't do in your last post). ---------------------------------------------------------------------- seghele0 · 2024-09-12 09:48 The program is attached. Thanks already. ---------------------------------------------------------------------- wp · 2024-09-12 09:52 You must also adjust the procedure declaration in the interface section of the unit. ---------------------------------------------------------------------- rvk · 2024-09-12 09:52 Quote from: seghele0 on September 12, 2024, 11:48:40 amThe program is attached. Thanks already. Ok. I see you still have a different header for the function in your class definition. You added the HintInfo in the implementation but didn't fix it in the interface part. So if you make the parameters in the class definition the same as below... then it should work. And if it doesn't... the actual error message would help us (without need to actually compile your code). ---------------------------------------------------------------------- seghele0 · 2024-09-12 10:29 I cleaned the lenses of my glasses. Eureca..... 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   TMainForm = class(TForm)    Button1: TButton;    Button2: TButton;    procedure FormCreate(Sender: TObject);    procedure OnHintHandler(var Hintstr: string; var CanShow: Boolean;              var HintInfo: THintInfo);  The procedure info has been adjusted. The application works. A special thank you for your efforts to help me.