Yes ! I've published a Record property

Yes ! I've published a Record property

it could be nice to have this feature in Delphi, but we need RTTI for record properties to simplify the code (and TReader should handle tkRecord aswell)

https://github.com/tothpaul/DelphiTips/tree/master/RecordProperty
https://github.com/tothpaul/DelphiTips/tree/master/RecordProperty

Comments

  1. and with the same code, I turn an internal static array of colors into a well formated published Record :)
    https://plus.google.com/photos/...

    ReplyDelete
  2. Nice, would be cool if you include the colors example in the github as well. Right now I can't really picture the benefits of this approach because I don't really see any records in unit1/unit2.

    ReplyDelete
  3. Johan Bontes the Record is just there

    https://github.com/tothpaul/DelphiTips/blob/master/RecordProperty/Execute.RecordProperty.pas#L21

    for the color record, it's not a record in fact, it's an array of color, but the published record use the same technic to map the record members to the internal array like I did with TRecoderPropertyHelper

    https://github.com/tothpaul/DelphiTips/blob/master/RecordProperty/Execute.RecordProperty.pas#L31

    but to edit this record you need also a Persistent class to map to the published record
    https://github.com/tothpaul/DelphiTips/blob/master/RecordProperty/Execute.RecordProperty.Register.pas#L14

    it's a bit or work, but to have the same editor without this code you have to create a subcomponent for each new level in the object inspector...it's also some work to do :)

    ReplyDelete

Post a Comment