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 6929879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:22:28+00:00 2026-05-27T11:22:28+00:00

I have added hints to components on my form. When the components receive the

  • 0

I have added hints to components on my form. When the components receive the focus, I’d like to set the caption of a label component to display the hint.

I have added a TApplicationEvents object and set the OnShowHint event to

procedure TImportFrm.ApplicationEvents1ShowHint(var HintStr: string;
  var CanShow: Boolean; var HintInfo: THintInfo);
begin
  HelpLbl.Caption := HintStr;
end;

However it seems that the ShowHint event only fires with mouse movements. Is there a way to fire the hint code when components receive focus, without having to implement the OnEnter event for every single component on the form?

  • 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-27T11:22:29+00:00Added an answer on May 27, 2026 at 11:22 am

    Add a handler for TScreen.OnActiveControlChange in your main form’s creation, and handle the hints in that event:

    type
      TForm2=class(TForm)
      ...
      private
        procedure ScreenFocusControlChange(Sender: TObject);
      end;
    
    implementation
    
    procedure TForm2.FormCreate(Sender: TObject);
    begin
      Screen.OnActiveControlChange := ScreenFocusControlChange;
    end;
    
    procedure TForm2.ScreenFocusControlChange(Sender: TObject);
    begin
      Label1.Caption := ActiveControl.Hint;
      Label1.Update;
    end;
    

    Note that Sender won’t do you much good; it’s always Screen. You can filter (for instance, to only change the Label.Caption for edit controls) by testing the ActiveControl:

    if (ActiveControl is TEdit) then
      // Update caption of label with ActiveControl.Hint
    

    Note that if you’ll need to reassign the event when you show child forms (to an event on that child form), or you’ll always be updating the original form’s label with the hints. The easiest way to do the reassignment is to give every form an OnActiveControlChange handler, and assign it in the form’s OnActivate event and unassign it in the OnDeactivate event:

    procedure TForm1.FormActivate(Sender: TObject);
    begin
      Screen.OnActiveControlChange := Self.ScreenActiveControlChange;
    end;
    
    procedure TForm1.FormDeactivate(Sender: TObject);
    begin
      Screen.OnActiveControlChange := nil;
    end;
    

    This will allow you to update controls other than Label1 on each form, and only use the hint changes on forms you want to do so.

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

Sidebar

Related Questions

I have added a checker to ensure that all fields in a form have
I have added the sdk files like dropbox website says, but I can't figure
I have a form on my website (based on Drupal), and I've added a
under Plone4/Zope3, I have a form to add a new object. I'd like to
I have added a navigation controller inside a viewcontroller thats inside another navigation controller...
I have added a plugin called scrollpaper to a site I'm working on. The
I have added an UIImageView as a subview in UIView , and then I
I have added an HTML file to my solution in VS2010. How do you
I have added a TextField to a UICell in order to allow a user
I have added an extra field Specification in Catalog->Product->Data tab. This text is stored

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.