Question

for my own TCollection descendant I want to extend the collection property editor. I want to see more columns for other properties of my TCollectionItem. And I am a lucky because it is pretty easy. The only thing I want to do was to override these three methods

TAttributeList = class(TOwnedCollection)
private
  ...
protected
  function GetAttrCount: Integer; override;
  function GetAttr(Index: Integer): string; override;
  function GetItemAttr(Index, ItemIndex: Integer): string; override;
public
  ...
end;

to retrieve the number of columns, the title of a column and the value of a column for an item of the collection.

Now I want to edit the attribute cells. Is fun stopping here and I have write a complete collection editor by myself (perhaps as a copy or desendant of TCollectionEditor in unit ColnEdit.pas)?

I hope there is something simpler but otherwise I interesting in examples of build an complex TCollectionEditor.

Ciao Heinz Z.

Was it helpful?

Solution

The intent here is to provide those extra column attributes as published properties on the TCollectionItem's themselves. So when you select the item, it is selected into the object inspector where you can then edit and change the values.

Just create a descendant of TCollectionItem and publish the properties that represent the extra attributes you want to be editable. Make sure when you construct the TCollection descendant, you specify your TCollectionItem type to instantiate.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top