Saturday, November 14, 2009

Save/Load controls from IniFile using RTTI

Here's a nice trick that you can use if you're in a hurry and need to implement a method to save/load controls to/from a ini file.
This method is using RTTI(Run Time Type Information), actually 3 methods from TypInfo unit: IsPublishedProp(checks if object has property), GetPropValue(retrieves the value of a property) and SetPropValue(sets the value of a property).
I've created a unit which handles saving and loading.uDGCtrlUtils.pas