Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Neue Komponente: Objektinspektor: Keine Expandierung möglich (https://www.delphipraxis.net/146512-neue-komponente-objektinspektor-keine-expandierung-moeglich.html)

angos 21. Jan 2010 13:51


Neue Komponente: Objektinspektor: Keine Expandierung möglich
 
Hi,

ich möchte mir eine neue Komponente erstellen. Dieses soll ein erweitertes StringGrid sein.

Nun stehe ich vor dem Problem eine "aufklappbare" Eigenschaft im Objektinspektor korrekt zu integrieren. Diese Eigenschaft ist einfach ein weiteres Objekt mit mehreren Properties.
Die Eigenschaft "CellColors" wird im Objektinspektor auch angezeigt, es wird auch das + Zeichen zum aufklappen gezeigt, aber beim Klick auf das + kommt die Meldung: "Keine Expandierung möglich".

Was mache ich also falsch?

Hier einmal der Code (die relevanten Stellen) dazu:

Delphi-Quellcode:
type
  TCellColors = class(TObject)
  private
    FColorEvenRow: TColor;
    FColorFixedCell: TColor;
    FColorSelection: TColor;
    FColorOddRow: TColor;
    procedure SetColorEvenRow(const Value: TColor);
    procedure SetColorFixedCell(const Value: TColor);
    procedure SetColorSelection(const Value: TColor);
    procedure SetColorOddRow(const Value: TColor);
  public
    constructor Create; overload;
  published
    property ColorFixedCell: TColor read FColorFixedCell write SetColorFixedCell;
    property ColorSelection: TColor read FColorSelection write SetColorSelection;
    property ColorEvenRow: TColor read FColorEvenRow write SetColorEvenRow;
    property ColorOddRow: TColor read FColorOddRow write SetColorOddRow;
  end;

  TAGStringGrid = class(TStringGrid)
  private
    FCellColors: TCellColors;
    procedure SetCellColors(const Value: TCellColors);
    { Private-Deklarationen }
  protected
    { Protected-Deklarationen }
    procedure DrawCell(ACol, ARow: Longint; ARect: TRect;
      AState: TGridDrawState); override;
  public
    { Public-Deklarationen }
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; reintroduce;
  published
    { Published-Deklarationen }

{ Diese Eigenschaft soll im Objektinspektor bearbeitbar sein! 
  Also, wie muss ich das deklarieren?
}
    property CellColors: TCellColors read FCellColors write SetCellColors;
  end;

procedure Register;
gruß
angos

Blup 21. Jan 2010 14:25

Re: Neue Komponente: Objektinspektor: Keine Expandierung mög
 
Vieleicht so:
Delphi-Quellcode:
TCellColors = class(TPersistent)
Eventuell noch Assign() überschreiben.

angos 21. Jan 2010 15:05

Re: Neue Komponente: Objektinspektor: Keine Expandierung mög
 
Vielen Dank. Das wars!

Gruß
angos


Alle Zeitangaben in WEZ +1. Es ist jetzt 19:35 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz