PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Overview
  • Local procedure
  • Procedures local to a window
  • Procedures local to a report
  • Procedures local to a control
  • 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
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
Overview
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, report or control) in which this procedure was declared. This local procedure is stored in the object.
    Versions 26 and later
    From version 26, you can create procedures local to controls (in a window or report).
    New in version 26
    From version 26, you can create procedures local to controls (in a window or report).
    From version 26, you can create procedures local to controls (in a window or report).
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 later
    You have the ability to create overloaded procedures. For more details, see Prototype overload.
    New in version 16
    You 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
iPhone/iPad This feature is available for iPhone/iPad applications.
New in version 17
iPhone/iPad This feature is available for iPhone/iPad applications.
iPhone/iPad This feature is available for 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.
Local procedure
Universal Windows 10 AppWindows MobileAndroidiPhone/iPadApple WatchJava

Procedures local to a window

The local procedures declared in a window can be called from all processes/events:
  • of the window,
  • of the window controls,
  • of the local procedures associated with the window.
These procedures are stored in the window.
Limits:
  • The local procedures of a window cannot be used by its sibling windows.
  • The local procedures declared in a child window cannot be used in its parent window.
Windows MobileiPhone/iPad

Procedures local to a report

The local procedures declared in a report can be called from all processes/events:
  • of the report,
  • of report controls,
  • of the local procedures associated with the report.
These procedures are stored in the report.
Versions 26 and later

Procedures local to a control

Local procedures declared in a control can be called from all processes/events:
  • of the control,
  • of the local procedures associated with the control.
These procedures are stored with the control. When the control is copied, the local procedures associated with it will be copied.
You can make procedures local to controls in a window, page or report.
New in version 26

Procedures local to a control

Local procedures declared in a control can be called from all processes/events:
  • of the control,
  • of the local procedures associated with the control.
These procedures are stored with the control. When the control is copied, the local procedures associated with it will be copied.
You can make procedures local to controls in a window, page or report.

Procedures local to a control

Local procedures declared in a control can be called from all processes/events:
  • of the control,
  • of the local procedures associated with the control.
These procedures are stored with the control. When the control is copied, the local procedures associated with it will be copied.
You can make procedures local to controls in a window, page or report.
Creating a local procedure

Creation from the code editor

To create a procedure local to the current element from the code editor:
  • Method 1:
    • WINDEV Mobile To create a procedure local to a window, control or report, go to the "Code" tab, "Procedures" group, expand "New" and select "New local procedure" (or press F4).
    • In the window that appears:
      • Specify the name of the procedure to create.
      • Versions 21 and later
        The option "Generate a header comment" is used to automatically generate the comment for the procedure prototype.
        For more details, see Automatic documentation of procedures.
        New in version 21
        The option "Generate a header comment" is used to automatically generate the comment for the procedure prototype.
        For more details, see Automatic documentation of procedures.
        The option "Generate a header comment" is used to automatically generate the comment for the procedure prototype.
        For more details, see Automatic documentation of procedures.
      • Versions 24 and later
        Specify the role of the procedure: Undefined, Business, UI. By default, procedures have an "Undefined" role.
        New in version 24
        Specify the role of the procedure: Undefined, Business, UI. By default, procedures have an "Undefined" role.
        Specify the role of the procedure: Undefined, Business, UI. By default, procedures have an "Undefined" role.
      • Versions 26 and later
        If the code editor shows the code of a control, the "Create the procedure within the control" option allows you to specify whether or not the local procedure should be associated with the control.
        New in version 26
        If the code editor shows the code of a control, the "Create the procedure within the control" option allows you to specify whether or not the local procedure should be associated with the control.
        If the code editor shows the code of a control, the "Create the procedure within the control" option allows you to specify whether or not the local procedure should be associated with the control.
    • Click the "Add" button. The local procedure is created. The created procedure is public by default. For more details, see Public or private local procedure.
  • Method 2:
    • WINDEV Mobile To create a local procedure: select "New .. New local procedure" from the popup menu.
    • In the window that appears:
      • Specify the name of the procedure to create.
      • Versions 21 and later
        The option "Generate a header comment" is used to automatically generate the comment for the procedure prototype.
        For more details, see Automatic documentation of procedures.
        New in version 21
        The option "Generate a header comment" is used to automatically generate the comment for the procedure prototype.
        For more details, see Automatic documentation of procedures.
        The option "Generate a header comment" is used to automatically generate the comment for the procedure prototype.
        For more details, see Automatic documentation of procedures.
      • Versions 24 and later
        Specify the role of the procedure: Undefined, Business, UI. By default, procedures have an "Undefined" role.
        New in version 24
        Specify the role of the procedure: Undefined, Business, UI. By default, procedures have an "Undefined" role.
        Specify the role of the procedure: Undefined, Business, UI. By default, procedures have an "Undefined" role.
      • Versions 26 and later
        If the code editor shows the code of a control, the "Create the procedure within the control" option allows you to specify whether or not the local procedure should be associated with the control.
        New in version 26
        If the code editor shows the code of a control, the "Create the procedure within the control" option allows you to specify whether or not the local procedure should be associated with the control.
        If the code editor shows the code of a control, the "Create the procedure within the control" option allows you to specify whether or not the local procedure should be associated with the control.
    • Click the "Add" button. The local procedure is created. The created procedure is public by default. For more details, see Public or private local procedure.
  • Versions 22 and later
    Method 3: To create a local procedure:
    • Position the cursor in the event "Global declarations" of the window or page, or in the "Opening" event of the report.
    • Type the prototype of procedure to create.
    • Validate. The local procedure is automatically created.
    New in version 22
    Method 3: To create a local procedure:
    • Position the cursor in the event "Global declarations" of the window or page, or in the "Opening" event of the report.
    • 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, or in the "Opening" event of the report.
    • 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:
  1. Select the corresponding code.
  2. Select "New .. Create a local 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 local procedure from the "Project explorer" pane:
  1. Select the element associated with the local procedure (window, page, report, control, etc.).
  2. Expand the element options and select "Procedures".
    Remark: If a control has no associated procedures, the "Procedures" option will not appear. In this case, select the name of the control.
  3. Open the context menu.
  4. Select:
    • In the window that appears:
      • Specify the name of new local procedure.
      • Versions 21 and later
        The option "Generate a header comment" is used to automatically generate the comment for the procedure prototype.
        For more details, see Automatic documentation of procedures.
        New in version 21
        The option "Generate a header comment" is used to automatically generate the comment for the procedure prototype.
        For more details, see Automatic documentation of procedures.
        The option "Generate a header comment" is used to automatically generate the comment for the procedure prototype.
        For more details, see Automatic documentation of procedures.
      • Versions 24 and later
        Specify the role of the procedure: Undefined, Business, UI. By default, procedures have an "Undefined" role.
        New in version 24
        Specify the role of the procedure: Undefined, Business, UI. By default, procedures have an "Undefined" role.
        Specify the role of the procedure: Undefined, Business, UI. By default, procedures have an "Undefined" role.
    • Click the "Add" button. The local procedure is created. The created procedure is public by default. For more details, see Public or private local procedure.
    • Validate.

    Displaying the list of local procedures

    To display the list of local procedures in the "Project explorer" pane, go to the code editor and press F8.
    Deleting a local procedure
    To delete a local procedure from the "Project explorer" pane:
    1. Select the element associated with the local procedure (window, page, report, control, etc.).
    2. Expand the element options.
    3. Expand "Procedures".
    4. Select the desired procedure.
    5. Open the context menu of the procedure and select "Delete".
    Public or private local procedure
    A local procedure is public by default: it is accessible from anywhere in the code.
    In some cases, it may be useful to restrict the access to a local procedure by making it "Private".
    Versions 19 and later
    When creating a local procedure, you have the ability to specify whether the procedure is public or private.
    New in version 19
    When 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:
    1. Select the local 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.
    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.
    Minimum version required
    • Version 12
    This page is also available for…
    Comments
    Click [Add] to post a comment