Recent

Author Topic: RegisterPropertyEditor for own apps' TObjectInspectorDlg or TTIPropertyGrid  (Read 1368 times)

CCRDude

  • Hero Member
  • *****
  • Posts: 612
I've got some controls I've created to use during runtime, but want to convert them to designtime now. To learn a bit more, easier play around with properties, &c.

For this, I've created a test app with my controls, first added a TTIPropertyGrid, then a TObjectInspectorDlg.

Standard published properties work well.

Some of these have content (a custom table has entries, a custom menu has entries, ...) I want to set up during designtime as well. So I wrote a property editor, and here I'm stuck currently on all three approaches:

1. My "MenuItems" property appears in Lazarus IDE when installing the package, but not in my app, even though I call the RegisterPropertyEditor during runtime as well. How can I add this property editor so that it works in my own projects as well?

2. Easiest way to edit subitems would be the OI. So my own control tree adds them, but ultimately, I want them in Lazarus, and in the standard TObjectInspectorDlg as well. I checked the LCL and implemented GetChildren and GetEnumerator, but that doesn't help the subitems to appear in OI's list. What can I do to have subitems there?

3. In my own app, the dropdown for TBasicAction is empty. In my property editor used in Lazarus IDE (using TTIPropertyGrid), it's also empty. I hope adding items to the OI's list helps there. The Property Editor is modal, how can I implement this similar to editing menus? I think they use a component editor instead, but how do I tell inside the component editor window that something should be selected/displayed in OI?

Please forgive me if this in plain simple - UI basically never was my focus!

CCRDude

  • Hero Member
  • *****
  • Posts: 612
I've got a very small success... while checking the .lfm, I noticed that the subitem was actually stored inside the .lfm. Maybe because I was setting SetSubComponent(true)?

It doesn't restore yet when loading the project (but I haven't implemented anything in that regard yet), and it still doesn't show in OI though.


CCRDude

  • Hero Member
  • *****
  • Posts: 612
Got great help on the German lazarusforum.de: having the property be a descendant of TCollection immediately solves "everything" - it appears in OI, items can be added, sorted, edited.

While I prefer TObjectList<TMyObjectItem> over TCollection, that's a very simple solution. My TCollectionItem descendants do not have a name property I can use in OI, so it's still not completely perfect, but I can access all items using their assigned actions as well.

 

TinyPortal © 2005-2018