How Do I Implement Changes Done in Existing Component, Into a Host Application Using This Component? (Magic xpa 4.x)
Once you have created a component, and loaded it into your project, it is easy to implement changes to the component. There are two aspects to implementing changes. First, there is the case where you are moving a component into a runtime environment, where the host application is not being changed. Second, there is the case where you are using the component in the Studio, and will want to use whatever new items are in the component. Both cases are discussed below.
When you are making changes to a component that is being installed in a runtime environment, implementation is straightforward: just replace the old component with the new one. This kind of installation would happen when, for instance, you are fixing a bug in a component or making a routine run faster, or doing some other internal fix. As long as the names of the objects and their arguments don’t change, you don’t need to change the host.
If you add items to the component, the host won’t pick up the new objects -- it didn’t use the objects before, so it doesn’t know about them now, so nothing will break. However, if you change the public name of an existing object, or change the parameters of a program, then that can cause a fatal error.
When changes are made to a component that you are working with in the Studio, however, you need to change the .eci file to reflect the changes, or you will not see the new objects. In this case, you need to do the following steps:
-
If the component is one you created, then generate a new .eci file. This is similar to the procedure described in Creating a Magic xpa Component, except you will modify an existing component rather than creating it from scratch.
If you received the component from another party, then you should receive a new .eci file along with the new component.
-
Go to Project->CRR (Shift+F7) and position the cursor on the component you want to update.
-
Select Options->Load/Reload Components. You will be prompted for the name of the .eci file to use. Select the .eci file and click Open.
This will refresh the components list, and you can work with the new components.
Hint: Do not be tempted to delete the old component and reload it. If you do that, all references to the component objects will be lost. Load/Reload will refresh the references correctly.
Within the Magic xpa Studio, the “name” of an object is not fixed, because the Studio references most items using an internal reference system. However, once you start making objects available to other programs, the references are done based on the actual text name, as is done on other programming tools.
So, there really is no graceful way to rename a component object once it is in use. If you rename an object and try to reload the component library, you will receive an “Item not available” message in the object name column, and all links to it will be broken.
Therefore it is recommended that when you design your components, you follow a strategy similar to that used in the development of COM libraries. Do not change the public names of your objects, do not change the arguments passed to a program, and do not delete objects. If you want to implement a new improved Calendar object, for instance, call the new one Calendar2 and leave the original Calendar in place.