- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


2796:Using OnHint Events Among Mulitiple Forms

KEYWORDS: HINT TFORM TAPPLICATION HELP AREA: VCL Programming

               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;



        TI



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile