Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi ActiveControl von eingebundenem Form? (https://www.delphipraxis.net/143240-activecontrol-von-eingebundenem-form.html)

Kalfany 12. Nov 2009 11:05


ActiveControl von eingebundenem Form?
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hallo,

ich würde gerne auf ActiveControl eines auf einem Panel erstellten Formulars zugreifen.

Leider funktioniert das nicht so wie ich es mir vorstelle (vorletzte Zeile). Wenn ich über Screen.ActiveForm.ActiveControl gehe funktioniert es ja auch?!

Durch den SpeedButton dürfte es ja seinen Fokus nicht verlieren.

Delphi-Quellcode:
procedure TForm2.FormCreate(Sender: TObject);
begin
  FTEstForm                := TForm3.Create(Self);
  FTEstForm.Parent         := Panel1;
  FTEstForm.BorderStyle    := bsNone;
  FTEstForm.Align          := alClient;
  FTEstForm.Visible        := true;
end;

procedure TForm2.SpeedButton1Click(Sender: TObject);
begin
  Memo1.Lines.Clear;
  Memo1.Lines.Add('Screen.ActiveForm.ACtiveControl: ' + Screen.ActiveForm.ActiveControl.Name);
  if Assigned(FTEstForm.ActiveControl) then
    Memo1.Lines.Add('FTEstForm.ActiveControl: ' + FTEstForm.ActiveControl.Name)
  else
    Memo1.Lines.Add('FTEstForm.ActiveControl: nil ! <-- warum?');
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 19:45 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz