OnShowHint (C++)
Description
This example uses three speed buttons on a panel. The code changes the color, width, and position of the text in the Help Hint for the third speed button. Set the ShowHint property of each speed button to True and give a value to the Hint property of each. You must declare the DoShow method in the type declaration of the form. Once it is declared, write the code for the DoShow method in the implementation part of the unit. Finally, in the OnCreate event handler for the form, assign the method to the OnShowHint event of the application.
Code
void __fastcall TForm1::DoShowHint(UnicodeString &HintStr, bool &CanShow, THintInfo &HintInfo)
{
if (HintInfo.HintControl == SpeedButton3)
{
HintInfo.HintColor = clAqua;// Changes apply only for this hint.
HintInfo.HintMaxWidth = 120; // Hint text word wraps if width is greater than 120.
HintInfo.HintPos.x += SpeedButton3->Width; // Move hint to the right edge.
}
}
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Application->ShowHint = true;
Application->OnShowHint = DoShowHint;
}
Uses
- Vcl.Forms.TApplication.OnShowHint ( fr | de | ja )
- Vcl.Forms.THintInfo ( fr | de | ja )