LMD DesignPack Guide


Design Module


TLMDModule component represents designing-module. A module contains a reference to its root control: form, report or other custom root. A module centralizes some utilities and events. There utilities are used by other design pack controls and eventually can be used by user.

 

A module also stores some additional designing state. While values for almost all properties are stored directly inside component instances, for other properties it is not true. For example, while at run-time event property value – is a pointer to class method, at design-time value is a logical pointer to some additional data structure that describes event handler. Such data structures – is additional root state stored inside a module.

 

At this point it important to note again, that event handlers can be attached only to root or root children properties, because only such components are considered in designing process. Also, it is important for module root saving/loading.

 

For some LMD-DesignPack components the reference to a module must be set, while for others it is optional. For example, for the designer to work you must specify a module. This is because the designer always designs a module, not individual objects. But, for property inspector a module is optional, because you can actually inspect standalone object properties.

 

The module is also can be required at run-time, not only at design-time. At run-time it used to load previously designed and saved root control, and also to “hook” run-time event handlers.

 

Working with event handlers

 

While designing and after loading a root its event handlers – are “design-time event handlers” that is design-time event handler descriptors, as was described above. After root is loaded at run-time you can replace design-time event handlers by real run-time handlers. This can be done by using HookEvents method. HookEvents iterates thought event properties that have associated handlers and fire OnHookEvent event for each such property. You have to implement OnHookEvent event handler using services provided by run-time language host. If you, for example, use LMD-ScriptPack as a language for event handlers, you can just call TLMDScriptControl.HookEvent method. For other language hosts, you should consult the host provider.

 

Modification notification

 

The TLMDModule component provides OnCompsModified event. This event is fired automatically when some LMD-DesignPack controls changes the module components. As described in Global component modification notifications section you can easily use this event to mark you IDE document as modified. There are no need to use any other events like TLMDDesigner.OnChange or TLMDPropertyInspector.OnChange.