Sorry if the question was asked before. I have some definition of some components as follows (please guide me if this is wrong, because I'm a newbie). What I'm trying to do is list all published properties of derived components, especially sub-properties. I can list property names, however, is it possible to list published properties for which I can access elements (as in sub-properties) at runtime? something like returning properties one by one, like getfirst / getnext, to the end?
type TStringArray = array of string; TGenericColumnDef = class(TPersistent) private fColumnName : String; fColumnNumber : Integer; fColumnDisplay : string; fColumnDescription : string; fColumnDataType : integer; fColumnEditorType : integer; // fMyEvent: TNotifyEvent; protected public constructor create(AOwner: TComponent); virtual; published property ColumnName : String read fColumnName write fColumnName; property ColumnNumber : integer read fColumnNumber write fColumnNumber; //property MyEvent: TNotifyEvent read fMyEvent write fMyEvent; end; TGenericAsset = class(Tcomponent) //TPersistent private { Private declarations } fCiteID : TGenericColumnDef; fCiteType : TGenericColumnDef; fTitle : TGenericColumnDef; fAuthor : TGenericColumnDef; fPropertyCount : integer; function GetPropertyCount : integer; function GetNextPropertyIndex: integer; property CountProperties : integer read GetPropertyCount;// write fPropertyCount protected { Protected declarations } FOwner: TObject; public { Public declarations } constructor Create(AOwner: TComponent); override; destructor destory ; virtual; function GetColumnNameByColumnNumber(ColumnNumber : Integer) : String; function GetColumnNames : TStringArray; // function GetFirst : TGenericColumnDef; published property CiteID : TGenericColumnDef read fCiteID write fCiteID; property CiteType : TGenericColumnDef read fCiteType write fCiteType; property Title : TGenericColumnDef read fTitle write fTitle; property Author : TGenericColumnDef read fAuthor write fAuthor; //property Nthproperty ......... end; //derived from TGenericAsset type TEditedBook = class(TGenericAsset) private protected public published property CiteID : TGenericColumnDef read fCiteID write fCiteID; property Title : TGenericColumnDef read fTitle write fTitle; property Author : TGenericColumnDef read fAuthor write fAuthor; end;
Any points or recommendations (sample code) are highly appreciated. Thanks in advance.
source share