|
|
|
|
|
- Overview
- Including the component in the project
- Including the component in a project
- Files automatically copied when the component is included in a project
- Handling the component elements through programming
- Remark: the technical documentation about the component
- Name conflicts
- Using a component procedure in dynamic compilation
- Classes and components
- Updating a component
- Creating the executable
- Deploying an application that uses a component
Using an external component in an application
An external component can be reused at any time in any application: you just need to know the directory that contains the external component files. This help page explains how to: Including the component in the project Including the component in a project To include a component in a project: - Open the project in WINDEV, WEBDEV or WINDEV Mobile.
- On the "Project" tab, in the "Project" group, expand "Import" and select "An External component .. From a file". A file picker appears.
- Select the WDI file of the component to import. Depending on the selected distribution mode, this file can be found:
- in the creation directory of the component if the computer where the component is created and the computer where the component is used are identical,
- in the directory where the component files have been made available,
- in the directory where the setup procedure of the component has copied the component files.
For more details, see Distributing a component.
- Validate. The description window of the selected component appears. This window shows:
- the component description (company, version, ...).
You have the ability to choose the load mode of the component (when starting the project or when using a component element for the first time). By default, the component is loaded when a component element is used for the first time. - the component documentation. This documentation explains how to use the different elements of the component.
- Validate. The accessible and usable component elements are displayed in the "Project explorer" pane. A specific icon indicates that the element comes from a component.
Files automatically copied when the component is included in a project When a component is included in the project, all the files required by the component are automatically copied into the project directory: - The <Component name>.WDI file is copied into the project directory.
- The <Component name>.WDK file is copied into the EXE subdirectory of the project.
- If some files have been specified in the optional file (<Component name>.WDO), these files are copied into the EXE directory of the project (by respecting the tree structure specified in the WDO file).
Handling the component elements through programming The visible elements of a component included in a project can be handled through programming only. To handle a component element (window, etc.) through programming, handle the element like any other element created in the project. - See the documentation about the element.
To do so, perform one of the following operations: - double-click the element from the "Project explorer" pane.
- press F2 from the element code.
- The element documentation is displayed in the code editor. This documentation presents the parameters required for using the element (input/output parameters, ...).
- Use the element according to the information specified in the documentation as if this element belonged to the project.
- To open a window, use Open and pass (if necessary) the parameters expected by this window.
Open(ComponentWindow [, Param1, Param2])
- To print a report, use iPrintReport and pass (if necessary) the parameters expected by this report.
iPrintReport(ComponentReport [, Param1, Param2])
- To call a procedure, use the usual syntax.
ComponentProcedure(Param1,Param2)
- To use a class, declare a variable of the class type.
MyVariable is object ComponentClass
The variable is then used like any object variable.
If a conflict occurs with a project element, the element name must be prefixed by the component name. For example: Open(MyComponent.MyWindow)
To use the element name in a variable, the component name must be specified. For example: sWindow is string = "MyComponent.MyWindow" Open(sWindow)
No specific WLanguage function is required to handle the component. Remark: the technical documentation about the component The technical documentation of component is available: - when a component is included in a project: on the "Project" tab, in the "Project" group, expand "Import" and select "An External component .. From a file".
- in the description of the components included in the project:
- In the "Project explorer" pane, select the "External components" folder.
- Open the context menu and select "List of external components imported into the project".
- The [Description] button is used to get information and documentation about the component.
Name conflicts Caution: if a project element and a component element have the same name, the component element must be prefixed by the component name. For example, the "Menu" window is available in the current project and in the "Email" component used by the project. The following syntax allows you to open the "Menu" window of the "Email" component: Using a component procedure in dynamic compilation To use a component procedure in dynamic compilation: - The component must necessarily be loaded. The component can be defined as "Loaded when the application is started" or it can be loaded by ComponentLoad.
- The full name must be used to identify the procedure and this name must be followed by brackets to indicate that a procedure must be used (instead of a global variable):
ComponentName.SetName.ProcedureName()
Remark: You can also use Execute:
Exécute("ComponentName.SetName.ProcedureName")
Classes and components A component can contain classes in its interface. You can derive these classes in the host project, override virtual methods and achieve polymorphism. The inheritance is available between several levels of components. - When a new version of a component is available, all you have to do is install the new files of this update in the installation directory of the component (according to the setup mode used). For more details on the different modes to install a component, see Distributing a component.
- When opening a project that uses this component, the change of component version will be automatically detected and a project update will be proposed. We recommend that you recompile the project.
Remark: You can force the update of a component from the list of components found in the project: - In the "Project explorer" pane, select the "External components" folder.
- Open the context menu and select "List of external components imported into the project".
- Click the "Update" button.
- If the component was distributed with a WINDEV application, the component must be updated. For more details, see Deploying an application that uses a component.
Deploying an application that uses a component An application that uses one or more components is deployed in the same way as a standard application.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|