|
- Definition
- Global procedure
- Global procedures and sets of procedures
- Global server and browser procedures
- Creating a global procedure
- Creation from the code editor
- Creation from the "Project explorer" pane
- Displaying the list of global procedures
- Deleting a global procedure
- Deletion from the code editor
- Deletion from the "Project explorer" pane
- Test of a global procedure
- From the code editor
- From the "Project explorer" pane
- Public or private global procedure
Global procedure/function
Two types of procedures are available: - Global procedure: can be used in all the project processes. This global procedure is stored in the project.
- Local procedure: can be used in all processes related to the object (window or report) where this procedure was declared. This local procedure is stored in the object.
Important: You must not declare two procedures with the same name (especially a global procedure and a local procedure). Reminder: - In WLanguage, there is no distinction between the procedures and the functions. The syntaxes for declaring and using procedures also apply to functions.
Versions 16 and laterYou have the ability to create overloaded procedures. For more details, see Prototype overload. New in version 16You have the ability to create overloaded procedures. For more details, see Prototype overload. You have the ability to create overloaded procedures. For more details, see Prototype overload.
Versions 17 and later New in version 17 Versions 18 and later New in version 18 Versions 21 and later New in version 21 Creating a global procedure Creation from the code editor To create a global procedure from the code editor: - Method 1:
- On the "Code" pane, in the "Procedures" group, expand "New" and select "New global procedure" (Shift + F4).
- In the window that is displayed:
- Specify the name of the procedure to create.
Versions 21 and laterThe option "Generate a header comment" is used to automatically generate the comment for the procedure prototype. See Automatic documentation of procedures for more details New in version 21The option "Generate a header comment" is used to automatically generate the comment for the procedure prototype. See Automatic documentation of procedures for more details The option "Generate a header comment" is used to automatically generate the comment for the procedure prototype. See Automatic documentation of procedures for more details- Specify the scope of procedure. The created procedure is public by default. For more details, see Public or private global procedure.
- Method 2:
- Select "New .. New empty global procedure" from the popup menu.
- In the window that is displayed:
- Specify the name of the procedure to create.
Versions 21 and laterThe option "Generate a header comment" is used to automatically generate the comment for the procedure prototype. See Automatic documentation of procedures for more details New in version 21The option "Generate a header comment" is used to automatically generate the comment for the procedure prototype. See Automatic documentation of procedures for more details The option "Generate a header comment" is used to automatically generate the comment for the procedure prototype. See Automatic documentation of procedures for more details- Specify the scope of procedure. The created procedure is public by default. For more details, see Public or private global procedure.
Versions 22 and laterMethod 3: - Position at the end of the procedure code.
- Type the prototype of procedure to create.
- Validate. The procedure is automatically created.
New in version 22Method 3: - Position at the end of the procedure code.
- Type the prototype of procedure to create.
- Validate. The procedure is automatically created.
Method 3: - Position at the end of the procedure code.
- Type the prototype of procedure to create.
- Validate. The procedure is automatically created.
To transform a code section already typed in a global procedure into a global procedure: - Select the corresponding code.
- Select "New .. Create a global procedure containing the selected code" from the popup menu.
- Specify:
- The procedure is created, the corresponding code is replaced by the call to the procedure with the necessary parameters.
Creation from the "Project explorer" pane To create a global procedure from the "Project explorer" pane: - Select the "Procedures" folder.
- Select the desired set of procedures.
- Display the popup menu of the set of procedures and select "New global procedure".
- In the window that is displayed:
- Specify the name of the new global procedure.
Versions 21 and laterThe option "Generate a header comment" is used to automatically generate the comment for the procedure prototype. See Automatic documentation of procedures for more details New in version 21The option "Generate a header comment" is used to automatically generate the comment for the procedure prototype. See Automatic documentation of procedures for more details The option "Generate a header comment" is used to automatically generate the comment for the procedure prototype. See Automatic documentation of procedures for more details- Specify the scope of procedure. The created procedure is public by default. For more details, see Public or private global procedure.
- Validate.
Displaying the list of global procedures To display the list of global procedures, press Ctrl + F8 in the code editor. The global procedures are displayed in the "Project explorer" pane if this pane is displayed. Deleting a global procedure Versions 16 and laterDeletion from the code editor To delete a global procedure from the code editor: - Click the bar of the procedure in the code editor.
- Select "Delete" from the popup menu.
New in version 16Deletion from the code editor To delete a global procedure from the code editor: - Click the bar of the procedure in the code editor.
- Select "Delete" from the popup menu.
Deletion from the code editor To delete a global procedure from the code editor: - Click the bar of the procedure in the code editor.
- Select "Delete" from the popup menu.
Deletion from the "Project explorer" pane To delete a global procedure from the "Project explorer" pane: - Select the "Procedures" folder.
- Select the desired set of procedures.
- Display the popup menu of the set of procedures and select "Delete".
Test of a global procedure From the code editor To test a global procedure: - Display the global procedure in the code editor.
- Click the "GO" button among the quick access buttons.
- The description window of the procedure test is displayed. This window is used to:
- Enter the different parameters of the procedure.
- Run the procedure test ("Run the procedure test").
- Check the return value.
From the "Project explorer" pane To test a global procedure: - Select the "Procedures" folder in the "Project explorer" pane.
- Select the name of the global procedure whose test must be run.
- Select "Run the procedure test" from the popup menu.
- The description window of the procedure test is displayed. This window is used to:
- Enter the different parameters of the procedure.
- Run the procedure test ("Run the procedure test").
- Check the return value.
Public or private global procedure A global procedure is public by default: it is accessible from any code. In some cases, it may be useful to restrict the access to a global procedure by making it "Private". In this case, the global procedure can only be accessed from another global procedure found in the set of procedures. Versions 19 and laterWhen creating a global procedure, you have the ability to specify whether the procedure is public or private. New in version 19When creating a global procedure, you have the ability to specify whether the procedure is public or private. When creating a global procedure, you have the ability to specify whether the procedure is public or private.To modify the access mode to a global procedure: - Select the global procedure in the "Project explorer" pane.
- In the popup menu of the procedure, select the new access mode::
Versions 16 and laterThe color of the procedure bar changes according to its access mode: - red beginning of bar: private procedure.
- standard beginning of bar: public procedure.
New in version 16The color of the procedure bar changes according to its access mode: - red beginning of bar: private procedure.
- standard beginning of bar: public procedure.
The color of the procedure bar changes according to its access mode: - red beginning of bar: private procedure.
- standard beginning of bar: public procedure.
Remark: External component and private global procedures: The use of private or public global procedures has an impact in the external components. Indeed, only the procedures explicitly declared as private (with the PRIVATE keyword used in their prototype) found in an external component cannot be directly used by the project that includes this component.
This page is also available for…
|
|
|
| |
| Click [Add] to post a comment |
|
| |
|
| |
| |
| |
| |
| |
| |
| | |
| |