views:

192

answers:

1

Hello,

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.

+2  A: 

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.

Allen Bauer
Hello Allen, I've already implemented the properties in the way you describe. But I wan a more grid like editing for these properties. At the moment I have always to change between keyboard and mouse (specially when I want go back from object inspector to collection editor.
Heinz Z.
In that case, you will need implement your own collection editor. The provided collection editor was intended to be a general purpose as possible and, in conjunction with the Object Inspector, work with a wide variety of collections and items.
Allen Bauer