Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7699549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:30:17+00:00 2026-05-31T22:30:17+00:00

I am using Lazarus v0.9.30 (32 bit compiler). I have the following code that

  • 0

I am using Lazarus v0.9.30 (32 bit compiler).
I have the following code that I use to show the hint text stored in the object associated with a TColumnTitle object in a TStringGrid.

procedure TTmMainForm.TmApplicationPropertiesShowHint
    (
    var HintStr: string; 
    var CanShow: boolean; 
    var HintInfo: THintInfo
    );
var
  aGrid        : TStringGrid;
  aColumnTitle : TTmColumnTitle;
  aRow         : integer;
  aColumn      : integer;
begin
  aRow    := 0;
  aColumn := 0;

  HintInfo.HintMaxWidth := 200;
  HintInfo.HideTimeout  := 10000;
  HintInfo.HintColor    := $00D7FBFA;

  //Get a pointer to the current grid.
  aGrid := TStringGrid(HintInfo.HintControl);

  //Find out what cell the mouse is pointing at.
  aGrid.MouseToCell(HintInfo.CursorPos.X, HintInfo.CursorPos.Y, aColumn, aRow);

  if ((aRow = 0) and (aColumn < aGrid.ColCount)) then
    begin
      //Get the object associated with the column title.
      aColumnTitle := TTmColumnTitle(aGrid.Objects[aColumn, aRow]);

      //Define where the hint window will be displayed.
      HintInfo.CursorRect := aGrid.CellRect(aColumn, aRow);

      //Display the hint.
      HintStr := Trim(aColumnTitle.stHint);
    end; {if}
end;   

I have access to the HintInfo object and want to use it to change the fontsize of the hint text. The HintInfo object provides access to HintInfo.HintControl.Font but using this changes the font of all the cell text in the underlying TStringGrid. The HintInfo object also provides access to Hintinfo.HintWindowClass.Font, but you are unable to access Font.Size. Is there a way to modify the font size of the hint?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T22:30:18+00:00Added an answer on May 31, 2026 at 10:30 pm

    There’s the TScreen.HintFont property which is intended for this purpose, however it seems to me wrong in its getter. One thing I can say at this time, it doesn’t work as expected.
    And since you don’t have an access to the hint window instance, the best what you can do is to subclass the common hint window class.

    In the following example I’ve created the custom hint window class where you can specify the font size by passing the size value through HintInfo.HintData which was currently unused.

    uses
      Windows, Types;
    
    type
      TCustomHintWindow = class(THintWindow)
      private
        function CalcHintRect(MaxWidth: Integer; const AHint: string;
          AData: Pointer): TRect; override;
      end;
    
    const
      HintBorderWidth = 2;
    
    implementation
    
    function TCustomHintWindow.CalcHintRect(MaxWidth: Integer; const AHint: string;
      AData: Pointer): TRect;
    begin
      if MaxWidth <= 0 then
        MaxWidth := Screen.Width - 4 * HintBorderWidth;
      Result := Types.Rect(0, 0, MaxWidth, Screen.Height - 4 * HintBorderWidth);
      if AHint = '' then
        Exit;
      if Assigned(AData) then
        Canvas.Font.Size := Integer(AData);
      DrawText(Canvas.GetUpdatedHandle([csFontValid]), PChar(AHint), Length(AHint),
        Result, DT_CALCRECT or DT_NOPREFIX or DT_WORDBREAK);
      Inc(Result.Right, 4 * HintBorderWidth);
      Inc(Result.Bottom, 4 * HintBorderWidth);
    end; 
    
    procedure TForm1.ApplicationProperties1ShowHint(var HintStr: string;
      var CanShow: Boolean; var HintInfo: THintInfo);
    begin
      HintInfo.HintColor := $0000ECFF;
      HintInfo.HintData := Pointer(12);
      HintStr := 'Hi I''m just a testing hint...';
    end;
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      HintWindowClass := TCustomHintWindow;
    end;
    

    Here’s a screenshot how it looks like:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have managed to use SAPI Text-To-Speech in Delphi/Lazarus by using the following code:
I have a project on Lazarus that I want to compile a source using
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
I have written a program using Free Pascal and the Lazarus IDE. In brief,
I'm planning on building an application that simplifies web design. I intent using Lazarus/FreePascal
Using report builder 3.0, I have a report that queries a cube. How do
Using CRM 4, I have an entity form that contains a tab with an
I am using Lazarus 0.9.30.2. I have a standard TForm with a standard TStringGrid
Using the following code, I'm able to successfully open a raw disk on my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.