不可能的,你是如何写的? 我是这样写的,假设他们都是TEdit. procedure TForm1.Timer1Timer(Sender: TObject); begin Label1.Caption:=IntTostr((ActiveControl as TEdit).Handle); end;procedure TForm1.Edit1Enter(Sender: TObject); begin Label2.caption:=intToStr((sender as TEdit).Handle); end;
那我如何知道,现在获得焦点的控件的类型呢,请教wingsun
用Delphi的RTTI。判断可以用if Form.ActiveControl is TButton then之类
两者不一样。
我是这样写的,假设他们都是TEdit.
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Label1.Caption:=IntTostr((ActiveControl as TEdit).Handle);
end;procedure TForm1.Edit1Enter(Sender: TObject);
begin
Label2.caption:=intToStr((sender as TEdit).Handle);
end;
ActiveControl.ClassType
ActiveControl.ClassName
ActiveControl.ClassNameIs
ActiveControl.ClassInfo
返回RTTI信息。不就知道了吗。