Design Time Interaction > Reusable Layouts |
True DBGrid provides a reusable layout facility that enables you to store one or more grid layouts in a binary file, then recall them as needed at design time or run time. With this feature, you can:
Create repositories of grid layouts that you can reuse in future projects.
Reduce the number of grids on a form by associating multiple layouts with a single grid control.
Change the layout at run time with very little coding.
Save end-user layout preferences to a file, then reload them the next time the application is run.
Initialize a grid on an HTML page by downloading a layout file asynchronously.
At design time, use the LayoutFileName and LayoutName properties to specify the current layout. Then, use the appropriate visual editing menu commands to load, save, or remove the current layout.
At run time, use the LayoutName property and LoadLayout method to restore a layout from the file specified by the LayoutFileName property. To add a new layout to the current layout file, or replace an existing layout in the file, use the Add method of the Layouts collection. To remove a layout from the current layout file, use the Remove method of the Layouts collection.
If you use a TDBGrid or TDBDropDown control on an HTML page, you can set the LayoutURL property to initiate asynchronous downloading of a layout file from an HTTP server. When the grid has finished downloading the file, it will fire the LayoutReady event. Your script code should handle this event by using the LayoutName property and LoadLayout method to restore a particular layout.