|
|
|
|
|
- Loading in memory an external component integrated into the project
- Loading an external component independent of the project
ComponentLoad (Function) In french: ComposantCharge Loads an external component. This component can be: - an external component present in the current project. In this case the external component is loaded in memory until the application is closed.
- an external component independent of the current project. The component is loaded in a variable of type Component. This makes it possible to get a global interface that can be used in the component.
Remarks: - External component integrated into project: The loading mode of the external component (at project launch, or when a component element is used for the first time) is defined when the component is integrated into the project.
- When the component is loaded, the following WLanguage events are executed:
- Declaration of the classes of the external component.
- Declaration of the sets of procedures of the external component.
- Initialization of the external component.
ResChargement is int
ResChargement = ComponentLoad(MonComposant, "C:\MonApplication")
SWITCH ResChargement
CASE cisAbsent:
Error("Le chemin spécifié ne correspond pas au composant externe indiqué")
CASE cisVersionTooOld, cisVersionTooRecent:
Error("La version du composant externe est incompatible avec l'exécutable")
CASE cisLoaded:
Info("Composant externe chargé")
END
compo is Component
IF ComponentLoad(compo, fExeDir() + fSep() + "CompoExemple.wdk") THEN
Trace("OK")
Trace(ComponentExecute("ProcéduresGlobales.Test"))
Trace(ComponentExecute("ProcéduresGlobales.TestAvecParam", (1)))
END
Syntax
Loading an external component integrated into the project Hide the details
<Result> = ComponentLoad(<Component name> [, <Component directory> [, <Load mode>]])
<Result>: Integer constant Status report of the load operation:
| | cisAbsent | The external component is not found in the specified path. | cisLoaded | The external component was successfully loaded. | cisVersionTooOld | The version of the external component is too old. It is not compatible with the current executable. | cisVersionTooRecent | The version of the external component is too recent. It is not compatible with the current executable. |
<Component name>: Character string Name of the external component (as it appears in the editor) to load. A WLanguage error occurs if the name of the external component is unknown. <Component directory>: Optional character string Directory of the external component (WDK file) to load. This directory may (or may not) end with a "\". A full path, a relative path or a UNC path can be used.If this parameter is not specified, the external component will be searched: <Load mode>: Optional Integer constant Load mode of the external component. Corresponds to one of the following constants:
| | ccGlobal | The external component is loaded globally. For example, the same context will be used if the component is loaded by the project and by a project component. | ccIsolated (Default value) | The external component is isolated. For example, if the component is loaded by the project and by a project component, each component will use a specific context. |
Loading an external component independent of the current project Hide the details
<Result> = ComponentLoad(<Component> , <Component name>)
<Result>: Boolean - True if the component has been loaded,
- False otherwise.
<Component>: Component variable Name of the Component variable in which the component is to be loaded. <Component name>: Character string Full path and physical name of the external component to be loaded (WDK file). Remarks Loading in memory an external component integrated into the project The loading mode of the external component is defined when the component is integrated into the project. It can be loaded when the project is started or when an element of the component is used for the first time. To change the loading mode: - Display the list of external components imported into the project:
- In the "Project explorer" pane, select the "External components" folder.
- Open the context menu of the folder and select "List of external components imported into the project".
- Select the desired component and click "Description".
- Change the load mode ("Component load mode" option).
Reminder: When a component is loaded, the following WLanguage events are executed: - Declaration of the classes of the external component.
- Declaration of the sets of procedures of the external component.
- Initialization of the external component.
Loading an external component independent of the project ComponentLoad does not cause fatal errors. The function returns False in the following cases: - the component is not found.
- the loaded component is being replaced with another component.
Business / UI classification: Neutral code
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|