LMD DesignPack Guide


Designing, Running and Streaming


You can switch between design-time and run-time modes, which differ in control appearance and behaviour, using Active boolean property of TLMDDesigner. Setting it to True activates the design-time mode. It should be ensured that TLMDModule.Root property is set to a valid Root component with its Parent set to nil. Setting it Active property to False switches controls to the run-time mode.

 

Notes on mode switching

 

When a component is in designing state its State property includes csDesigning flag. For many components this flag changes component behavior and visual representation. For example, TImage component draws dotted rectangle around itself in design mode. Unfortunately, VCL components are not designed to switch between design-time and run-time modes on the fly.

 

For example, TImage will not remove its dotted rectangle after designer deactivation. For some known component classes it can be sufficient to invalidate the root, but generally the only correct algorithm is to recreate the root or at least its children by saving module to stream before designer deactivation and loading it from stream after deactivation.

 

Streaming (storing and loading) design layouts

 

Design layout including component properties' values and event handlers can be saved to a file a loaded from it. It is performed by Save and Load methods of TLMDModule components respectively.