OnHint (C++)

From RAD Studio Code Examples
Jump to: navigation, search


This example shows how to use the OnHint event handler of the Application object.

This code provides the implementation of the DisplayHint method and assigns it to the Application object in the form's OnCreate event handler.

Note: It is not actually necessary to write an OnHint event handler to display hints on the status bar. This can be accomplished more simply by setting the status bar's AutoHint and SimplePanel properties.


void __fastcall TForm1::DisplayHint(TObject *Sender)
  StatusBar1->SimpleText = GetLongHint(Application->Hint);

// Here is the form's OnCreate event handler.
// It assigns the application's OnHint event handler at
// run time, because the Application is not available in 
// the Object Inspector at design time.
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
  Application->OnHint = DisplayHint;


Code Samples