Mega Code Archive

 
Categories / Delphi / Examples
 

Hints for menu items

How can I create hints for Menu items? On your form, we assume you have a MainMenu and a Statusbar type TForm1 = class(TForm) ... procedure FormCreate(Sender: TObject); private procedure HintHandler(Sender: TObject); ... procedure TForm1.FormCreate(Sender: TObject); begin // Each time our application will have to display a hint // it will trigger the HintHandler procedure Application.OnHint := HintHandler; end; procedure TForm1.HintHandler(Sender: TObject); begin // you can use GetLongHint(Application.Hint) function // to extract the long part of the hint if there is one StatusBar1.SimpleText := Application.Hint; if StatusBar1.SimpleText = '' then StatusBar1.Refresh; // To force the StatusBar to paint its panels again end;