Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls, ExtCtrls;
- type
- TForm1 = class(TForm)
- Edit1: TEdit;
- Button1: TButton;
- Edit2: TEdit;
- Button2: TButton;
- Timer1: TTimer;
- Panel1: TPanel;
- Edit3: TEdit;
- procedure FormCreate(Sender: TObject);
- procedure Timer1Timer(Sender: TObject);
- private
- procedure SelectedEditEnter(Sender: TObject);
- procedure SelectedEditExit(Sender: TObject);
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- var
- SelectedEdit: TEdit = nil;
- procedure TForm1.SelectedEditEnter(Sender: TObject);
- begin
- SelectedEdit := (Sender as TEdit);
- end;
- procedure TForm1.SelectedEditExit(Sender: TObject);
- begin
- SelectedEdit := nil;
- end;
- procedure TForm1.FormCreate(Sender: TObject);
- var
- i: Integer;
- begin
- for i := 0 to Pred(ComponentCount) do
- if Components[i].ClassName = 'TEdit' then
- begin
- (Components[i] as TEdit).OnEnter := SelectedEditEnter;
- (Components[i] as TEdit).OnExit := SelectedEditExit;
- end;
- end;
- procedure TForm1.Timer1Timer(Sender: TObject);
- begin
- if Assigned(SelectedEdit) then
- Caption := SelectedEdit.Name
- else
- Caption := '';
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement