I am creating a Delphi vcl component, the component class has a "images" property that allows me to select a TImagelist.
The component class also has subroutine βbuttonsβ that themselves have the imageindex property.
I wrote a component editor for the imageindex property so that I can select the button image from imagelist; I have done this in other components before, but the problem that I am currently facing is that I need to get the base class image property from the event in the event of the "buttons" subclass.
So, the base class of the component has the following properties:
property Buttons: TFlexButtons read FButtons write FButtons; property Images: TCustomImageList read FImages write SetImages;
The button class has the following property:
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1;
I register the property editor in a separate block for the ImageIndex property to select an image, but in this case I need to get the image from the base layer of the component, how can I get this property from this auxiliary property
function TImageIndexProperty.GetImageListAt(Index: Integer): TCustomImageList; var APersistent: TPersistent; begin APersistent := GetComponent(Index); if APersistent is TFlexButton then Result := ??????????.Images //how do i refer to the images property of the component here? else Result := nil; end;
All classes:
TFlexButton = class(TCollectionItem) private FWidth: Word; FCaption: string; FHeight: Word; FImageIndex: TImageIndex; procedure SetCaption(const Value: string); procedure SetHeight(const Value: Word); procedure SetWidth(const Value: Word); procedure SetImageIndex(const Value: TImageIndex); public constructor Create(AOwner: TComponent); destructor Destroy; override; published property Caption: string read FCaption write SetCaption; property Height: Word read FHeight write SetHeight; property Width: Word read FWidth write SetWidth; property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1; end; TFlexButtons = class(TCollection) private function GetItem(Index: Integer): TFlexButton; public function Add: TFlexButton; property Item[index: Integer]: TFlexButton read GetItem; end; TFlexButtonGroupBox = class(TcxGroupBox) private FDataLink: TFieldDataLink; FAbout: string; FAlignment: TAlignment; FEnabled: Boolean; FButtons: TFlexButtons; FImages: TCustomImageList; FSql: TStrings; FAutosize: Boolean; procedure SetAlignment(const Value: TAlignment); function GetDataField: string; function GetDataSource: TdataSource; procedure SetDataField(const Value: string); procedure SetDataSource(const Value: TdataSource); procedure DataChange(Sender: TObject); procedure SetEnabled(const Value: Boolean); procedure SetImages(const Value: TCustomImageList); procedure SetSql(const Value: TStrings); procedure SetAutosize(const Value: Boolean); protected public procedure Loaded; override; constructor Create(AOwner: TComponent); override; destructor Destroy; override; published property DataField: string read GetDataField write SetDataField; property DataSource: TdataSource read GetDataSource write SetDataSource; property Enabled: Boolean read FEnabled write SetEnabled; property Autosize: Boolean read FAutosize write SetAutosize; property About: string read FAbout write FAbout; property Buttons: TFlexButtons read FButtons write FButtons; property Images: TCustomImageList read FImages write SetImages; property Alignment: TAlignment read FAlignment write SetAlignment; property Sql: TStrings read FSql write SetSql; end;
source share