|
- Overview
- Local procedure
- Procedures local to a window
- Procedures local to a page
- Procedures local to a report
- Creating a local procedure
- Creation from the code editor
- Creation from the "Project explorer" pane
- Displaying the list of local procedures
- Deleting a local procedure
- Public or private local procedure
Two types of procedures are available: - Global procedure: can be used in all the processes/events of the project. This global procedure is stored in the project.
- Local procedure: can be used in all processes/events that depend on the object (window, page or report) in which 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. See Prototype overload for more details. New in version 16You have the ability to create overloaded procedures. See Prototype overload for more details. You have the ability to create overloaded procedures. See Prototype overload for more details.
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 local procedure Creation from the code editor To create a procedure local to the current element from the code editor: - Method 1:
 To create a local procedure, go to the "Code" pane, "Procedures" group, expand "New" and select "New local procedure" (or press F4). To create a local server procedure: on the "Code" pane, in the "Procedures" group, expand "New" and select "New local procedure (Server)". To create a local browser procedure: on the "Code" pane, in the "Procedures" group, expand "New" and select "New local procedure (Browser)". - 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 procedure scope. The created procedure is public by default. See Public or private local procedure for more details.
- Method 2:
 To create a local procedure: select "New .. New local procedure" from the popup menu. To create a local server procedure, select "New .. New local procedure (Server)". To create a local browser procedure, select "New .. New local procedure (Browser)". - 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 procedure scope. The created procedure is public by default. See Public or private local procedure for more details.
Versions 22 and laterMethod 3: To create a local procedure: - Position the cursor in the event "Global declarations" of the window or page.
- Type the prototype of procedure to create.
- Validate. The local procedure is automatically created.
New in version 22Method 3: To create a local procedure: - Position the cursor in the event "Global declarations" of the window or page.
- Type the prototype of procedure to create.
- Validate. The local procedure is automatically created.
Method 3: To create a local procedure:- Position the cursor in the event "Global declarations" of the window or page.
- Type the prototype of procedure to create.
- Validate. The local procedure is automatically created.
Remark: To transform a section of code already entered in a local procedure into a local procedure: - Select the corresponding code.
- Select "New .. Create a local 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.
Displaying the list of local procedures To display the list of local procedures, press F8 in the code editor. The list of local procedures is displayed in the "Project explorer" pane. Deleting a local procedure To delete a local procedure from the "Project explorer" pane: - Select the element associated with the local procedure (window, page, report, ...).
- Expand the element options.
- Expand the "Local procedures" option of the element.
- Select the desired procedure.
- Display the popup menu of the procedure and select "Delete".
Public or private local procedure A local procedure is public by default: it is accessible from any code. In some cases, it may be useful to restrict the access to a local procedure by making it "Private". Versions 19 and laterWhen creating a local procedure, you have the ability to specify whether the procedure is public or private. New in version 19When creating a local procedure, you have the ability to specify whether the procedure is public or private. When creating a local procedure, you have the ability to specify whether the procedure is public or private.To modify the access mode to a local procedure: - Select the local 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 or public local procedures: The use of private or public local procedures has an impact in the external components. Indeed, only the procedures explicitly declared as public (with the PUBLIC keyword used in their prototype) found in an external component cannot be accessed from the project that includes this component.
This page is also available for…
|
|
|
| |
| Click [Add] to post a comment |
|
| |
|
| |
| |
| |
| |
| |
| |
| | |
| |