Show / hide properties dynamically in IDE Object Inspector?

I came across an interesting feature when using Delhpi 10 Seattle. In Firedac, especially in the TFDConnection component, the Params property has some voodoo magic that can dynamically display and hide properties in the IDE on the fly, depending on the value of another specific property. (I don't know how long it has been available since I just started with Firedac). When you change the DriverID property in TFDConnection.Params , the remaining properties in Params displayed in the IDE object inspector to be able to specify driver-specific properties.

Now I’ve explored how this works, and this is a bunch of interface definitions rooted in IFDStanDefinition . I can’t understand how this actually works in the IDE, except that there the TStringList uses the functionality of the Name / Value pair.

I would like to implement the same thing in my own component, in particular, TCollectionItem has an ActionType property, which is an Enum type. I would like to dynamically show / hide properties depending on what value is selected for this property.

How can I implement the same ability to show / hide properties in the IDE Object Inspector in my own component collection element?

On the side of the note, I'm afraid that part of the answer is that it expects all string values, judging by how you interact with this Params property through code.

+5
source share
1 answer

Write a property editor and enable the paVolatileSubProperties attribute when GetAttributes returns. The rest is to release the old instance of the auxiliary property and replace it with a new one (but they can be any TPersistent descendants of the class, so it is not tied to the string list class).

+2
source

All Articles