Link a Library Widget to a Model component

This section explains how a Library Widget can be linked to a specific Model component

Each Library Widget can be linked to a specific (Schematic) Model component. In this way, a Library widget can be specialized to work only with particular components (for example customizing a Library Widget to control and monitor Machines).

To link a Library Widget to a Model Component, the Library Widget must first be created and saved to the Widget Library, and then it can be linked.

Detailed information on creating a Library Widget can be found here. When creating a Library Widget, you can specify the types of Model components that can be linked with this Library Widget (for example all supported Machine types). Model component types can be specified in the Link to Model Component tab in the Library Widget properties dialog (Figure 1).
Note: Component types can be easily obtained from Schematic Editor by right clicking on a Schematic component and selecting the Copy component information → Copy component type name action.
Note: When a Library Widget is already linked to a particular Model component, a few constants are injected into the Library Widget's local namespace (Figure 1). Specifically, this occurs every time a simulation is started, or the Library Widget is copy/cut/pasted, is dragged and dropped, or when the namespace manually initialized. At the same time when the constants are injected, the Library Widget Initialization code is executed.
When you drag and drop a Library Widget into a Panel, you should specify the particular Model component from the supported types (for example, a particular Machine), that needs to be linked with the Library Widget (Figure 2). This can also be set in the Library Widget properties dialog after the widget is added to the Panel (Figure 3).
Note: Components from supported types will only be listed if it exists in the loaded Model (*.cpd file)

Once a Model component is selected, the Library Widget is successfully linked to the particular Model component.