OnHint (Delphi)
Contents
Description
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.
Code
type
TForm1 = class(TForm)
Button1: TButton;
StatusBar1: TStatusBar;
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
procedure DisplayHint(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ Here is the implementation of the OnHint event handler. }
{ It displays the application's current hint in the status bar. }
procedure TForm1.DisplayHint(Sender: TObject);
begin
StatusBar1.SimpleText := GetLongHint(Application.Hint);
end;
{ 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. }
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnHint := DisplayHint;
end;
Uses
- Vcl.Forms.TApplication.Hint ( fr | de | ja )
- Vcl.Forms.TApplication.OnHint ( fr | de | ja )
- Vcl.Controls.GetLongHint ( fr | de | ja )