C++ Builder Tutorials

C++Builder Tips: Customizing Hints

Hints are the little windows that are shown when you move the mouse cursor over a component or a menu item. Hints can be customized: you can change their color, their timing, and even show more than one line of text.

Color and timing of hints

In the OnCreate event handler of the main form of your application, write this code:

void __fastcall TForm1::FormCreate(TObject *Sender)
  Application->HintColor = clAqua;   // color of your choice
  Application->HintPause = 250;      // 250 mSec before hint is shown
  Application->HintHidePause = 3000; // hint disappears after 3 secs

More lines in a Hint

If you want to display more than one line in the Hint of for example Button1:

- In the Object Inspector, don't write anything in Button1's Hint property.
- Set Button1's ShowHint property to True.
- In the FormCreate event handler of the form that contains Button1, add this code:

void __fastcall TForm1::FormCreate(TObject *Sender)
  Button1->Hint = "First line\nSecond line\nThird line";
  // Add more lines as desired.
  // Each \n indicates a newline code.