1. Home
  2. Computing & Technology
  3. Delphi Programming

Activate a control hint from code

By Zarko Gajic, About.com

Here's how to display a hint (tooltip) window for a control, from Delphi code:

~~~~~~~~~~~~~~~~~~~~~~~~~
procedure DoHint(AControl: TControl) ;
var
   pt: TPoint;
begin
   pt := AControl.ClientToScreen(Point(1,1)) ;
   SetCursorPos(pt.x, pt.y) ;
   Application.ActivateHint(pt) ;
end;

//Sample usage:
//Note: make sure ShowHint is set to True, and Hint property is assigned for Edit1! //DoHint(Edit1) ;
~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» How to set the "home page" for the Internet Explorer from Delphi code
« How to execute a method (procedure/function) by name

Explore Delphi Programming

More from About.com

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. 2004 Delphi Tips
  7. Activate a control hint from code

©2008 About.com, a part of The New York Times Company.

All rights reserved.