Components (Magic xpa 3.x)
You can define project objects as components. Exporting components lets you share resources among Magic xpa projects and also facilitates the distribution of project revisions.
Magic xpa provides you with wizards, which let you easily create components, such as Web Service and DLL components.
Magic xpa also lets you expose Magic xpa projects to the outside world using component interface builders.
Components are listed in the Composite Resource Repository. The interface displays the project objects that can be shared with other projects. The objects that can be shared are:
Models – Models are useful objects to have in a component. You can create a generic set of models to use between projects, which can simplify the project.
If you are creating a component for a specific type of application, to create email, for instance, you can expose the models that the host application will need to pass parameters. However, you don't have to expose models that are only used internally to your component.
The models that you want to expose will need to have a Public Name. Models without a Public Name cannot be seen when you create the component.
Data sources – Data sources are exposed in a similar way to models. Create a Public Name for each of the data sources you want to expose. It is not required that you expose data sources that are used only within the application. You need to expose data sources if the host application needs to use the tables within the host programs.
Programs – To expose programs, you need to give each program a Public Name. You also need to select the External check box.
Helps – You expose Help objects similarly to models and data sources: just give each object you wish to expose a Public Name.
Rights – You expose Rights similarly to models and data sources: just give each object you wish to expose a Public Name.
Events – You expose events by giving them a Public Name and selecting the Expose check box.
Functions and handlers – You can expose functions and handlers that are in the Main Program. Set the Scope to Global for the functions and handlers you want to expose.
The loaded component is integrated into another project and appears in the Composite Resource Repository. Any component object can be selected from the Object list.
When an application is used as a component, the project's color and font settings are ignored; instead, the colors and fonts of the host application are used to encourage uniformity, and avoid unnecessary complications.
When building a component, It is recommended that its colors and fonts be given large numbers, such as 500, 520 or larger. This helps to avoid the host and the component having the same color indexes, when a separation of the indexes is required.
Components chapter in the Mastering Magic xpa guide