Einzelnen Beitrag anzeigen

einbeliebigername

Registriert seit: 24. Aug 2004
140 Beiträge
 
Delphi XE8 Professional
 
#14

AW: Was ist falsch am Aufruf und Freigaben von Create

  Alt 5. Feb 2020, 09:19
Hallo,

Im Modul TMOHilfe steht folgendes im public

Delphi-Quellcode:
public
    { Public-Deklarationen }
    constructor Create;
    procedure Hilfe(aNutzerID: Int64; aPrgTeil, aHauptSeite, aUnterseite: SmallInt);
  end;
und im Create-Ereignis folgendes:
Delphi-Quellcode:
constructor TMoHilfe.Create;
begin
  GlobalPfad := TAppConstants.GetGlobalPath;
  PfadHandBuch := TAppConstants.GetHandBuchPfad;
end;
Der Constructor ist auch falsch. Er muss so sein:

Delphi-Quellcode:
public
    { Public-Deklarationen }
    constructor Create(AOwner: TComponent); override;
  end;
Delphi-Quellcode:
constructor TMoHilfe.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);

  GlobalPfad := TAppConstants.GetGlobalPath;
  PfadHandBuch := TAppConstants.GetHandBuchPfad;
end;
Sonst wird er vom Application.CreateForm nicht benutzt. Und ohne das inherited ist so ein Constructor bei einem DatenModul überhaupt nicht zu gebrauchen.
Mit freundlichen Grüßen, einbeliebigername.
  Mit Zitat antworten Zitat