I came across an interesting feature while using Delhpi 10 Seattle. In Firedac, specifically a TFDConnection
component, the Params
property has some voodoo magic which can dynamically show and hide the properties in the IDE on the fly, depending on the value of another particular property. (I have no idea how long this has been available since I just started with Firedac). When you change the DriverID
property in TFDConnection.Params
, the rest of the properties in the Params
show up in the IDE Object Inspector to be able to specify driver-specific properties.
Now I've investigated how this works, and it's a bunch of interface definitions, rooting from IFDStanDefinition
. I cannot figure out how it's actually performing this in the IDE, other than that there's a TStringList
involved utilizing the Name/Value pair functionality.
I would love to implement the same thing in my own component, in particular a TCollectionItem
has a property ActionType
which is an Enum type. I would like to dynamically show/hide properties depending on what value is selected for that one property.
How can I accomplish the same ability of showing/hiding properties in the IDE Object Inspector in my own component's collection item?
On a side note, I'm afraid part of the answer is that it expects all string values, judging by how you interact with this Params
property via code.
Write a property editor and include paVolatileSubProperties attribute when GetAttributes returns. The rest is about releasing old sub-property instance, and replacing with the new one (but they can be of any TPersistent class descendant, so it's not tied to the string list class).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With