TdxCustomTileControl.RestoreFromIniFile(string,Boolean,Boolean,string) Method
Restores the tile control’s settings from an INI file.
Declaration
procedure RestoreFromIniFile(const AStorageName: string; AChildrenCreating: Boolean = False; AChildrenDeleting: Boolean = False; const ARestoreName: string = '');
Parameters
Name | Type |
---|---|
AStorageName | string |
AChildrenCreating | Boolean |
AChildrenDeleting | Boolean |
ARestoreName | string |
Remarks
The StoreTo~ and RestoreFrom~
methods allow you to persist tile control settings across multiple sessions. Call the StoreToIniFile method to save the tile control’s settings to an INI file. Later, you can call the RestoreFromIniFile method to apply the stored settings to this or another tile control, restoring its state from the INI file. Refer to the StoreToIniFile method description to learn about the settings that are persisted by these methods.
The AStorageName parameter specifies the INI file path and name.
The AChildrenCreating parameter determines whether non-existent tile elements (groups and items) present within the INI file are created within the target tile control. On the contrary, the AChildrenDeleting parameter determines whether existing tile elements not present within the INI file are deleted when restoring.
The ARestoreName parameter corresponds to the ASaveName parameter of the store procedure.
If ASaveName is set to an empty string, the store procedure saves the tile control’s name to a data store. Use this mode to store tile control settings and then restore them in the same tile control. Tile groups and items are also saved by their names. If multiple groups/items with unassigned names are saved, only the settings of the last unnamed group/item will be persisted.
If a non-empty string is passed as ASaveName, the tile control’s name is ignored and tile control settings are stored under the specified name. This mode allows you to save settings of one tile control and then apply them to (restore in) another tile control. To enable this mode, pass the same name to both the ASaveName and ARestoreName parameters.
In this mode, groups and items are stored by their IDs. ID is a unique zero-based identifier that is assigned to a group/item when it is created at runtime. The ID of the first group/item is 0, the ID of the second one is 1, etc. When a group/item is deleted, a newly created group/item might get the ID of the deleted group/item. So, the IDs of groups/items won’t be reused within the current state of the tile control, but may be reused within the lifetime of the tile control. This is a limitation unique to these IDs.
The restore procedure
recognizes groups/items by their IDs, i.e., if the data store contains settings for groups/items with IDs equal to 0, 1, and 4 for instance, they are applied to the groups/items in the target tile control with the same IDs (0, 1,and 4). Non-existing groups/items are created/deleted based on the AChildrenCreating and AChildrenDeleting parameter values.
Note
You can handle the OnInitStoredObject event to properly initialize the object that corresponds to the re-created group or item (provided that the RestoreFromIniFile method is called with True passed as the AChildrenCreating parameter) by re-associating its events with existing event handlers and assigning its properties.