Autor Beitrag
Tower
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 99



BeitragVerfasst: Mi 29.01.03 10:49 
Hallo!

Ich habe eine Komponente erstellt, indem ich sie von einer bestehenden abgeleitet habe. Bei einer zugefügten Eigenschaft möchte ich jetzt einen Default-Wert setzen.
Laut Tutorials u.ä. muss man dies nicht nur per "default"-Schlüsselwort tun, sondern auch im Constructor. Deshalb sieht das im Moment so bei mir aus...

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
  TMyCheckBox = class(TDBCheckBox)
  private
    FActiveColor: TColor;
    [...]
  public
    constructor Create(AOwner: TComponent); override;
  published
    property ActiveColor: TColor read FActiveColor write FActiveColor default clWhite;
  end;

[...]

constructor TctDBCheckBox.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  
  ActiveColor := clWhite;
  [...]
end;


Aber leider ohne den erhofften Erfolg. Wenn ich die Komponente auf mein Form setze, steht ActiveColor immer auf clBlack.

Was muss ich anders machen?


Danke!
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Mi 29.01.03 11:22 
Hallo,

normalerweise ist Dein Ansatz schon richtig.

Probiere aber einmal in der Create statt "ActiveColor:=clWhite;" --> "fActiveColor:=clWhite".

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
Tower Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 99



BeitragVerfasst: Mi 29.01.03 11:47 
Das hatte ich vorher...
Leider das gleiche Ergebnis. Mist... :nixweiss: