PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • 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
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Definition
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 the procedures also apply to the functions.
  • Versions 16 and later
    You have the ability to create overloaded procedures. See Prototype overload for more details.
    New in version 16
    You 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 16 and later
Universal Windows 10 App This feature is available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This feature is available for the Windows Phone applications.
Universal Windows 10 App This feature is available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This feature is available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This feature is available for the iPhone/iPad applications.
iPhone/iPad This feature is available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
New in version 18
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
Versions 21 and later
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
New in version 21
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
Global procedure
WINDEVWEBDEV - Server codeReports and QueriesAndroidAndroid Widget iPhone/iPadApple WatchWindows MobileUniversal Windows 10 AppJava

Global procedures and sets of procedures

The global procedures are stored in sets of procedures, associated with the project. Each set of procedures is a ".WDG" file.
Each project contains at least one set of procedures. This set is created by default when creating the project.
The global procedures found in a set of procedures can be called from all the processes:
  • of project,
  • of the window or page (processes of window or page, processes of its controls and processes of associated local procedures),
  • of the report (processes of report, processes of its controls and processes of associated local procedures).
Tip: If a procedure is used by a single window or page, this procedure should be described as local to the window or to the page. In this case, the window/page is "independent".
WEBDEV - Server codeWEBDEV - Browser code

Global server and browser procedures

A project corresponding to a dynamic site contains at least two sets of procedures (a "server" one and a "browser" one).
When creating the project:
  • the set of server procedures is named "Global procedures of <Project Name>" (".WDG" file).
  • the set of browser procedures is named: "Global procedures of <Project Name>_Browser" (".WWN" file).
Remark: A set of global browser procedures is converted into a set of Javascript procedures. This set of Javascript procedures is saved in the "<Project Name>_WEB" directory and it is named "<Project Name>.JS". This set of procedures contains a declaration code and an ending code used to declare the variables global to the set of procedures.
Limit: No global browser procedure can be called by the global server procedures (and conversely).
Creating a global procedure

Creation from the code editor

To create a global procedure from the code editor:
  • Method 1:
    • Select "Insert .. New global procedure" (or press [Shift] [F4]).On the "Code" pane, in the "Procedures" group, expand "New" and select "New global procedure" (or press [Shift] [F4]).
    • In the window that is displayed:
  • Method 2:
    • Select "Create a procedure .. Create an empty global procedure" from the popup menu.Select "New .. New empty global procedure" from the popup menu.
    • In the window that is displayed:
  • Versions 22 and later
    Method 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 22
    Method 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.
WEBDEV - Server codeWEBDEV - Browser code Remarks:
  • If the current code is a server code, the global procedure is created in the set of server procedures. If the current code is a browser code, the global procedure is created in the set of browser procedures.
  • To create a global server procedure directly, select "Insert .. New global server procedure".To create a global server procedure directly, on the "Code" pane, in the "Procedures" group, expand "New" and select "New global procedure (Server)".
  • To create a global browser procedure directly, select "Insert .. New global browser procedure".To create a global browser procedure directly, on the "Code" pane, in the "Procedures" group, expand "New" and select "New global procedure (Browser)".
To transform a code section already typed in a global procedure into a global procedure:
  1. Select the corresponding code.
  2. Select "Create a procedure .. Create a global procedure containing the selected code" from the popup menu.Select "New .. Create a global procedure containing the selected code" from the popup menu.
  3. Specify:
  4. 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:
  1. Select the "Procedures" folder.
  2. Select the requested set of procedures.
  3. Display the popup menu of the set of procedures and select "New global procedure".
  4. In the window that is displayed:
  5. Validate.
WEBDEV - Server codeWEBDEV - Browser code To create a global server or browser procedure, select the corresponding set of procedures.

Displaying the list of global procedures

To display the list of global procedures, select "Display .. Global procedures" (or press [Ctrl] [F8]) in the code editor.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.
WEBDEV - Browser code Remark: To display the list of global browser procedures, select "Display .. Global browser procedures" (or press [Ctrl] [Alt] [F8]) in the code editor.
WEBDEV - Browser code Remark: To display the list of global browser procedures, press [Ctrl] [Alt] [F8] in the code editor.
Deleting a global procedure
Versions 16 and later

Deletion from the code editor

To delete a global procedure from the code editor:
  1. Click the bar of the procedure in the code editor.
  2. Select "Delete" from the popup menu.
New in version 16

Deletion from the code editor

To delete a global procedure from the code editor:
  1. Click the bar of the procedure in the code editor.
  2. Select "Delete" from the popup menu.

Deletion from the code editor

To delete a global procedure from the code editor:
  1. Click the bar of the procedure in the code editor.
  2. Select "Delete" from the popup menu.

Deletion from the "Project explorer" pane

To delete a global procedure from the "Project explorer" pane:
  1. Select the "Procedures" folder.
  2. Select the requested set of procedures.
  3. Display the popup menu of the set of procedures and select "Delete".
WEBDEV - Server codeWEBDEV - Browser code To delete a server or browser global procedure, select the corresponding set of procedures.
Test of a global procedure

From the code editor

To run the test of a global procedure:
  1. Display the global procedure in the code editor.
  2. Click the [GO] button.
  3. 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] button).
    • Check the return value.

From the "Project explorer" pane

To run the test of a global procedure:
  1. Select the "Procedures" folder in the project explorer.
  2. Select the name of the global procedure whose test must be run.
  3. Select "Run the procedure test" from the popup menu.
  4. 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] button).
    • 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 later
When creating a global procedure, you have the ability to specify whether the procedure is public or private.
New in version 19
When 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:
  1. Select the global procedure in the "Project explorer" pane.
  2. In the popup menu of the procedure, select the new access mode::
    • public.
    • private.
Versions 16 and later
The 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 16
The 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.
Note: 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.
Minimum version required
  • Version 12
This page is also available for…
Comments
Click [Add] to post a comment