LMD DesignPack Guide


Global Notifications


The new version of the LMD-DesignPack now use global component modification notifications feature. This means that any of LMD-DesignPack controls, like designer or property inspector, dispatches global notifications when changes some components. Also these same controls register itself to receive such notifications. This results in fully consistent view of editing components even without any explicit links between LMD-DesignPack controls.

 

For example, typically in the IDE application if you select some control in the designer this control also appear in the  property inspector. Also the object combo box can show the name of this selected control. So, if you will move or resize the selected control by the designer, Left, Top, Width and Height property values will be automatically updated in the property inspector. Another example, if you will rename the component by the property inspector (by changing its Name property value) the name shown in object combo box will be also automatically updated.

 

This feature is also used by the TLMDModule component. Every module register itself to receive global component modification notifications and fire OnCompsModified event, if the modified component is a child of the module's root. 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.

 

Note, that this mechanism is more correct then, for example, using the TLMDPropertyInspector.OnChange event. There are not so simple to mark correct IDE document as modified from the TLMDPropertyInspector.OnChange event. It is not sufficient to mark just currently active (focused) document.

 

Imagine, that you have two designing forms (with corresponding two modules, and two designers). Suppose that first form contain the TClientDataSet child component. Suppose that this client data set links to the TDataSource component residing on the second form. Suppose that the first designer is active and the client data set control is selected in the designer. Then you can edit its properties in the property inspector. But actually, since the property inspector is able to show linked components properties too, you can also edit the linked data source properties as well, e.g. by expanding DataSource property item in the property inspector.

 

So, as a result you will be able to change any data source properties, while the first designer is active (remember that the data source itself reside in the second designer module). The global component modification notifications will work correctly here and the OnCompsModified event will be fired for second module, not the first (currently active).

 

To stay consistent with new feature while modifying component manually in code, the LMDComponentChanged or LMDComponentsChanged functions should be called after modification. This will dispatch notifications and will allow all LMD-DesignPack controls to update its view.