Autor Beitrag
DT
Hält's aus hier
Beiträge: 3

Win 2000
D7 Prof
BeitragVerfasst: Di 06.09.05 09:22 
Ich habe eine eigene Klasse aus tForm abgeleitet, Eigenschaften definiert und registriert.

Im folgenden kleinen Beispiel reduziere ich alls auf die Eigenschaften TestBool und MyProps.TestBool

Beide Werte setze ich im Objectinspector auf True, aber leider wird während der Laufzeit nur TestBool auf True gesetzt.

MyProps bleiben unangetastet. Wieso? Was mache ich falsch? Die gleiche Struktur funktioniert bei anderen Komponenten - aber nicht beim Formular.

Bei der Erstellung des Packages habe ich den Compilerschalter 'RegisterFormular' gesetzt und die 'Verwenden für Entwurf' aktiviert.

Ich hoffe, dass mir jemand helfen kann.

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
unit TestForm;

interface

uses
  Classes, Forms;

type
  tMyForm = class;

  tMyFormProps = class(TPersistent)
  private
    fParent     : tMyForm    ;
    fTestBool   : boolean    ;

  published
    constructor Create( pForm : tMyForm );
    destructor  Destroy;

    property  TestBool     : boolean  read fTestBool     write fTestBool    ;
  end;

  tMyForm = class( tForm )
  private
    fTestBool     : boolean       ;
    fMyProps      : tMyFormProps  ;

  protected
  published
    property  TestBool     : boolean      read fTestBool     write fTestBool    ;
    property  MyProps      : tMyFormProps read fMyProps;

  public
    constructor Create(AOwner: TComponent); override;
    destructor  destroy; override;
  end;

procedure Register;

implementation

{$ifdef RegisterFormular }
uses
  DesignIntf,
  Designeditors,
  toolsapi;
{$endif}

constructor tMyFormProps.Create( pForm : tMyForm );
begin
  fParent       := pForm ;
  fTestBool     := false ;

  inherited Create;
end;

destructor tMyFormProps.Destroy;
begin
  inherited Destroy;
end;

constructor tMyForm.Create(AOwner: TComponent);
begin

  fMyProps  := tMyFormProps.Create( self );
  fTestBool := false;

  inherited Create(AOwner);

end;

destructor tMyForm.destroy;
begin
  fMyProps.Free;

  inherited destroy;
end;

procedure Register;
begin
{$ifdef RegisterFormular }
  RegisterCustomModule( tMyForm,  TCustomModule );
{$endif}
end;


end.


Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.
Moderiert von user profile iconTino: "Hilfe" aus Titel entfernt.
Einloggen, um Attachments anzusehen!
DT Threadstarter
Hält's aus hier
Beiträge: 3

Win 2000
D7 Prof
BeitragVerfasst: Di 06.09.05 11:14 
Ich habe in einem anderen Forum die Lösung erhalten. Ich benötige eine Dummy-Write-Procedure. Dann funktioniert es.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
  tMyForm = class( tForm )
  private
    ... 
    Procedure SetMyProps(const Value:tMyFormProps);

  published
    ...
    property  MyProps      : tMyFormProps read fMyProps  write SetMyProps;



  Procedure tMyForm.SetMyProps(const Value:tMyFormProps);
  Begin End;


Moderiert von user profile iconTino: Delphi-Tags hinzugefügt.