Autor Beitrag
midan23
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 48

Win XP, Mac OS X, Linux
D6 Pers, XCode 2.1, Python
BeitragVerfasst: Mo 16.05.05 11:24 
Hallo,

ich hätte da ein kleines Problem ...

Ich möchte mehrere Komponenten um eine Subkomponente erweitern. Dabei dachte ich, ich könnte ja auch gleich einige der Default-Werte ändern.
Das Einbinden der Subkomponente ist kein Problem, die Default-Werte bei den anderen Komponenten meines Projekts sind auch so weit fertig.
Einzige Ausnahme : TComboBox

Ich hab erst mal mit den Default-Werten anfangen wollen. Bis jetzt sieht die Sache so aus :
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:
unit MyComboBox;

interface

uses
  Windows, Messages, SysUtils, Classes, Controls, StdCtrls;

type
  TMyComboBox = class(TComboBox)
  private
    { Private-Deklarationen }
  protected
    { Protected-Deklarationen }
  public
    constructor Create(AOwner : TComponent); override;
    procedure CreateParams(var Params: TCreateParams); override;
  published
    { Published-Deklarationen }
  end;

procedure Register;

implementation

constructor TMyComboBox.Create(AOwner : TComponent);
begin
  inherited Create(AOwner);
  self.Width := 41;
end;

procedure TMyComboBox.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  self.Items.Add('Mo');
  self.Items.Add('Di');
  self.Items.Add('Mi');
  self.Items.Add('Do');
  self.Items.Add('Fr');
  self.Items.Add('Sa');
  self.Items.Add('So');
  self.ItemIndex := 0;
end;

procedure Register;
begin
  RegisterComponents('tst', [TMyComboBox]);
end;

end.


Mein Problem : Sobald ich diese Komponente auf eine Form ziehe, beendet sich Delphi ???

Was mache ich falsch ?