Einzelnen Beitrag anzeigen

Crowbar

Registriert seit: 17. Jun 2002
43 Beiträge
 
#6

Re: Über TWinControl an die "Caption"-Bezeichnung?

  Alt 29. Mär 2008, 21:22
Ich bin ich es doch noch einmal...
Zitat von mkinzler:
ActiveContrlCaption:=(C as TButton).Caption;
... aber etwas Schwieriger wird es sein, wenn ich nicht weiß, ob es gerade TButton, TForm usw. ist oder?

Delphi-Quellcode:
...
Var
C,FLastActiveControl : TWinControl;
ActiveContrlClass,ActiveContrlName,
ActiveContrlCaption : String;

begin
  ...
  FLastActiveControl:=Screen.ActiveControl;
  ...
{ Active controls }
  if (FLastActiveControl <> nil) then
   begin
     C:=FLastActiveControl;
     ActiveContrlClass:=C.ClassName;
     ActiveContrlName :=C.Name;
     ActiveContrlCaption:= (C as ???).Caption;
   end;
  ...
end;
Gruß
Crowbar
  Mit Zitat antworten Zitat