ILayoutStrategy

The ILayoutStrategy interface describes a class which can act as a layout strategy for the AutoFormPanel control. A layout strategy is responsible for arranging the input controls and labels of the entry form, usually in a container control of some kind such as a Grid.

See Creating Layout Strategies for information on creating new layout strategy classes. The two included strategy classes GridLayoutStrategy and StackedLayoutStrategy are also good references points.


Properties

AutoFormPanel FormPanel { get; set; }
Holds a reference to the AutoFormPanel instance whose controls are being arranged.

Methods

void Initialise(Dictionary<BaseFieldDefinition,Control> inputFields, Dictionary<BaseFieldDefinition,Control> fieldLabels);
This method is called when the AutoFormPanel is preparing to create the entry form. The stategy class should store references to the two supplied dictionaries and they will be needed when arranging the form controls.

void CreateLayout();
This method is called when the data entry form needs to be created. At this point the strategy should build a suitable container control and add the input controls and labels supplied to the Initialise method.

void DropLayout();
This method is called when the AutoFormPanel control has been unloaded. The strategy should drop all references it holds to any input controls and labels in this method. In particular this will happen when AutoFormPanel controls are used in a TabControl - the latter unloads the controls within tabs that are de-selected and recreates them when needed to save memory. If your layout strategy class keeps references to input controls when this happens then you'll encounter memory leaks at best, or exceptions at worse when input controls are added back into the form.

void LayoutChanged();
This method is not currently used and can be empty. In the future it may be called if AutoForm implements dynamic forms and the AutoFormPanel has changed in some way which affects the layout of controls on the form.

Last edited Oct 24, 2014 at 12:22 PM by DevKnightlie, version 2