Einzelnen Beitrag anzeigen

Benutzerbild von Stevie
Stevie

Registriert seit: 12. Aug 2003
Ort: Soest
4.008 Beiträge
 
Delphi 10.1 Berlin Enterprise
 
#1

TForm ableiten mit properties

  Alt 25. Jun 2004, 14:12
Hi Leute,

ich versuche gerade eine Klasse zu erstellen, die von TForm abgeleitet ist und über zusätzliche properties verfügt. Ich hab das folgendermaßen gemacht:
Delphi-Quellcode:
unit frCustomFormEx;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TCustomFormEx = class(TForm)
  private
    FSingleInstance: Boolean;
  published
    property SingleInstance: Boolean read FSingleInstance write FSingleInstance;
  end;

implementation

uses
  DesignIntf, DesignEditors;

procedure Register;
begin
  RegisterCustomModule(TCustomFormEx, TCustomModule);
end;

initialization
  RegisterClass(TCustomFormEx);

finalization
  UnRegisterClass(TCustomFormEx);

end.
Delphi-Quellcode:
unit frFormEx;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, frCustomFormEx;

type
  TFormEx = class(TCustomFormEx)
  end;

implementation

{$R *.dfm}

initialization
  RegisterClass(TFormEx);

finalization
  UnRegisterClass(TFormEx);

end.
Diese beiden Dateien hab ich in ein Package gepackt und installiert. Wenn ich jetzt ein neues Formular erstelle, und statt
class TForm1 = class(TForm) class TForm1 = class(TFormEx) schreibe, die dfm-Datei als Text öffne und das object in inherited umändere, dann hab ich im OI nicht meine neue Eigenschaft! Woran liegt's?
Stefan
“Simplicity, carried to the extreme, becomes elegance.” Jon Franklin

Delphi Sorcery - DSharp - Spring4D - TestInsight
  Mit Zitat antworten Zitat