community.borland.com

Article #15731: Using OnHint Events Among Mulitiple Forms

 Technical Information Database

TI731D.txt   Using OnHint Events Among Mulitiple Forms
Category   :VCL
Platform    :All
Product    :Delphi  All

Description:
               Using OnHint Among Multiple Forms
               ---------------------------------

Delphi's Online Help and Visual Component Library Reference
describe an example for processing TApplication's OnHint event.
The example shows how a panel can be used to display hints
associated with other components. As the example sets the
Application's OnHint method in the Form's OnCreate event, a
program involving more than one form will have difficulty using
this technique.

Moving the assignment of OnHint from the Form's OnCreate event
to its OnActivate method will allow different forms involved in
the application to treat Hints in their own way.

Here is an altered form of the source code presented in the
Online Help and the VCL Reference.

type
  TForm1 = class(TForm)
    Button1: TButton;
    Panel1: TPanel;
    Edit1: TEdit;
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    procedure DisplayHint(Sender: TObject);
  end;

implementation

{$R *.DFM}

procedure TForm1.DisplayHint(Sender: TObject);
begin
  Panel1.Caption := Application.Hint;
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
  Application.OnHint := DisplayHint;
end;




Reference:


7/16/98 4:33:53 PM
 

Last Modified: 01-SEP-99