6

I'm familiar with using Delphi RTTI to access "simple" properties (ints/enums/strings, etc) but I cannot grasp how to work with Array properties.

I'm starting by looking for array equivalents for the GetPropValue/SetPropValue calls. I'd expect to see similar ones to these, but taking an extra "index" parameter, but can't seem to find anything in the typinfo unit help.

2
  • 1
    Do you mean "properties of array type", or "indexed properties", here? Commented Jul 27, 2009 at 21:19
  • I mean these: "Property Coords[Index: Integer] : Longint read GetCoord write SetCoord;" hopefully that's an array property? Commented Jul 27, 2009 at 21:29

2 Answers 2

5

Arrays and array properties can't have RTTI for them up to D2009. But when Barry Kelly spoke at the Delphi Live conference about an enhanced RTTI system that's planned for D2010, he mentioned that everything, including arrays, would have RTTI available. So this is a feature to look forward to...

Sign up to request clarification or add additional context in comments.

3 Comments

Arrays have RTTI - pretty much all types will have RTTI. "Array properties", i.e. indexed properties, not in D+1 though.
Oh, they won't? I must have misunderstood then.
@BarryKelly better not use "indexed properties" moniker here, because it naturally sends (and probably officially designates too) to TPropInfo.Index which represents structures like property X: TCoord read GetCoord index 0; property Y: TCoord read GetCoord index 1; - those are perfectly supported in old/classic RTTI (unit TypInfo)
3

Not sure if it is possible. Array properties can't be published which implies they can't have RTTI.

Also, if you look at the components in the object inspector. There are no array properties there. All array properties have custom editors (Or I must have missed some).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.