Delphi-PRAXiS
Seite 2 von 2     12   

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 Problem mit Vererbung auf Frames (https://www.delphipraxis.net/125221-problem-mit-vererbung-auf-frames.html)

Samufi 2. Dez 2008 21:08

Re: Problem mit Vererbung auf Frames
 
Wenn ich das jetzt richtig verstanden habe, geht das also nicht... Na gut, ist auch nicht so schlimm, die Funktion kann ich ja auch in jede einzelne Unit kopieren. Trotzdem Danke fürs Antworten. Was das Programmierdesign angeht, da muss ich sowieso noch eine Menge lernen. Mit den beiden genannten Begriffen kann ich im Moment noch gar nichts anfangen, ich werde mich bei Gelegenheit mal damit befassen. Im Moment interessiert mich vor allem, dass es funktioniert...

Bernhard Geyer 2. Dez 2008 21:19

Re: Problem mit Vererbung auf Frames
 
Gut das du lernen willst. Hier mal die Basisunit umgebaut (soweit ich verstanden habe was du eigentlich machen willst):

Delphi-Quellcode:
// Kein Uses mehr auf Hauptunit nötig! Enge kopplung und gegenseitige Referenzierung der Units damit gelöst

type
  TMyCallBack = function(Sender: TObject; const Inhalt, Code: String): String;

  TFrame3 = class(TFrame)
  private
    FMyCallBack: TMyCallBack;
  public
    function Ausgabe(const Inhalt, Code: String): String;

    property MyCallBack: TMyCallBack read FMyCallBack write FMyCallBack;
  end;

implementation

function Tframe3.Ausgabe(const Inhalt, Code: String): String;
begin
  if Assigned(FMyCallBack) then
    result := FMyCallBack(self, Inhalt, Code)
  else
    result := '';
end;
und in der Hauptunit:

Delphi-Quellcode:
uses
  frames;

procedure TForm1.OnCreate;
begin
  FMyFrame := TFrame2.Create(self);
  ...
  FMyFrame.OnMyCallBack := DoMyCallBack;
end;

function TForm1.DoMyCallBack(Sender: TObject; const Inhalt, Code: String): String;
begin
  Inhalt.Text:=Inhalt;
  Code.Text:=Inhalt;
  Frame11.Findekomponente.Click;
end;

Bobo1 28. Nov 2012 16:17

AW: Problem mit Vererbung auf Frames
 
Existiert das Problem noch? Es gibt eine Lösung.

mueller_klaus46@yahoo.de


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:13 Uhr.
Seite 2 von 2     12   

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