Hello

Hello,

In this sample component
https://github.com/tothpaul/Delphi/blob/master/CollectionTest/CollectionTest.pas

What's wrong with MyProperty.MyCollection, the IDE do not provide a Collection Editor for this sub property :/

Comments

  1. Shouldn't TMyCollection tell what kind of item it expects?

    ReplyDelete
  2. it does : TMyCollection.Create(Self, TMyItem);

    the property is exactly the same in the two cases, but the IDE provide the editor only for MyComponent.MyCollection, not for MyComponent.MyProperty.MyCollection

    ReplyDelete
  3. Paul TOTH ah, in most my code that part is done by TMyCollection itself. Next try is adding a `initialization
    RegisterClass(TMyCollection);`

    ReplyDelete
  4. Jeroen Wiert Pluimers done, no change.

    Perhaps the RegisterPropertyEditor do not works for a sub property...

    That's one of the things that make me sad with Delphi IDE...I lose a lot of time to make things works at design time.

    ReplyDelete
  5. Odd. I know this works with TStrings in subproperties, but I've no concrete example of a component using a TCollection derived class as a subproperty, and I don't have enough time to do experimentation myself. Maybe David Berneda knows of such a situation?

    ReplyDelete
  6. ok, found the problem in TCollectionProperty.Edit;

    the code look for a TComponent Owner of the component...TMyProperty do not override GetOwner method,

    code fixed on GitHub

    ReplyDelete
  7. Jeroen Wiert Pluimers oops didn't know about GetOwner fix, I think I've never done a property editor for that case

    ReplyDelete
  8. Paul TOTH Is the code on github updated with the change about GetOwner?

    ReplyDelete

Post a Comment