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

Activate a control hint from code

By , About.com Guide

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
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  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

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

All rights reserved.