Entwickler-Ecke
Grafische Benutzeroberflächen (VCL & FireMonkey) - SubMenu im OI
Aya - So 13.10.02 18:57
Titel: SubMenu im OI
Hi,
Ich benutze bei meiner Komponente mehrere Farben die z.Z. noch alle wild durcheinander im ObjectInspector stehen...
Weiß jemand wie ich es so machen kann, wie es z.B. bei einem Form mit den "Constraints" gemacht ist??
Also einen Oberpunkt "Colors", und wenn man auf das Plus davor klickt, öffnen sich alle Farben die man ändern kann :) (So wie bei Constraints halt, nur mit TColor anstatt Integer)
Au'revoir,
Aya
Tino - So 13.10.02 21:41
Hi,
schau doch einfach mal in den Quelltext (falls vorhanden). Hier mal ein Auszug wie
TSizeConstraints definiert ist:
Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23:
| Type TSizeConstraints = class(TPersistent) private FControl: TControl; FMaxHeight: TConstraintSize; FMaxWidth: TConstraintSize; FMinHeight: TConstraintSize; FMinWidth: TConstraintSize; FOnChange: TNotifyEvent; procedure SetConstraints(Index: Integer; Value: TConstraintSize); protected procedure Change; dynamic; procedure AssignTo(Dest: TPersistent); override; property Control: TControl read FControl; public constructor Create(Control: TControl); virtual; property OnChange: TNotifyEvent read FOnChange write FOnChange; published property MaxHeight: TConstraintSize index 0 read FMaxHeight write SetConstraints default 0; property MaxWidth: TConstraintSize index 1 read FMaxWidth write SetConstraints default 0; property MinHeight: TConstraintSize index 2 read FMinHeight write SetConstraints default 0; property MinWidth: TConstraintSize index 3 read FMinWidth write SetConstraints default 0; end; |
Jetzt brauchst Du es nur noch überarbeiten. Also statt den Integer-Werten Color Eingeschaften einfügen usw. Die Implementation von tSizeConstraints findest Du in der Unit Controls.pas.
Gruß
TINO
Aya - So 13.10.02 22:43
Hi,
das hatte ich auchschon gesehen, aber irgendwie klappt's bei mir net... wenn ich auf das "+" klicke kommen keine weiteren attribute...
Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
| TColors = class(TPersistent) private fCol1: TColor; fCol2: TColor; fCol3: TColor; fCol4: TColor; protected public published property Color1: TColor index 0 read fCol1 write fCol1 Default clBlack; property Color2: TColor index 1 read fCol2 write fCol2 Default clBlack; property Color3: TColor index 2 read fCol3 write fCol3 Default clBlack; property Color4: TColor index 3 read fCol4 write fCol4 Default clBlack; end; |
Au'revoir,
Aya
Tino - Mo 14.10.02 07:52
Hallo,
als erstes solltest Du den Index-Teil rausnehmen. Macht in Deinem Fall keinen Sinn da Du für jedes Property eine eigene Variable benutzt. Also so:
Quelltext
1: 2: 3: 4: 5:
| published property Color1: TColor read fCol1 write fCol1 Default clBlack; property Color2: TColor read fCol2 write fCol2 Default clBlack; property Color3: TColor read fCol3 write fCol3 Default clBlack; property Color4: TColor read fCol4 write fCol4 Default clBlack; |
Dann würde ich erstmal die Assign Methode implementieren. Für die Anzeige im OI ist das glaube ich nicht notwendig aber wenn Du Deine Komponente veröffentlichen solltest sollte so ein Property wie tColors auch über so eine Methode verfügen.
Hast Du das Property in Deiner Komponenten im Constructor auch erstellt?
Gruß
TINO
Entwickler-Ecke.de based on phpBB
Copyright 2002 - 2011 by Tino Teuber, Copyright 2011 - 2026 by Christian Stelzmann Alle Rechte vorbehalten.
Alle Beiträge stammen von dritten Personen und dürfen geltendes Recht nicht verletzen.
Entwickler-Ecke und die zugehörigen Webseiten distanzieren sich ausdrücklich von Fremdinhalten jeglicher Art!