ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage syntax / WLanguage procedures
  • Overview
  • Procedures from a set of procedures
  • Methods of a class
  • Procedures of a control
  • Summary table
  • Scope changes
  • Changing the scope of a procedure
  • Migrating a project from an older version to version 28 or later
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
The scope of a procedure defines whether it is public, private, etc. This page presents the differences between the types of scope depending on the type of procedure, and how they affect your code.
The scope of the procedures may include:
  • The procedures from a set of procedures.
  • The methods of a class.
  • The procedures of a control.
Procedures from a set of procedures
There are different procedure scopes:
By default, procedures are "Public".
There are three possibilities:
  • Public procedure: The procedure can be used from any process or event of the project.
    In the case of a project to generate a SOAP Webservice, this public Procedure will be exported to the Webservice (the Procedure is an Visible entry point for the Webservice)..
  • Private procedure: The procedure cannot be used from another element of the project (sets of procedures, windows, etc.).
    In a project used to generate a web service, the private procedure will not be exported in the web service.
    The procedure can only be called from the set of procedures in which it is defined.
  • Restricted procedure: The procedure can be used anywhere in the project, but cannot be exported in a web service or external component.
Methods of a class
There are different class method scopes:
By default, class methods are "Public".
There are several possible cases:
  • Public method: the class method is accessible from any element of the project and is exported when generating an external Component or SOAP Webservice.
  • Restricted method: the class method remains usable in all project elements, but is not exported to external components or SOAP Webservices.
  • Protected method: the method can be accessed within the code of the class and derived classes only. The method is exported when an external Component or SOAP Webservice is generated.
  • Protected restricted method: the limitation is identical to the "protected" scope, but the method will not be exported when generating an external Component or SOAP Webservice.
  • Private method: the method can only be accessed within the code of the current class.
Procedures of a control
Some controls, such as the Smart controls included in the IDE, contain local procedures. These procedures can be public or private.
Private procedures can only be used in the control they belong to. This allows you to isolate code and avoid unnecessary calls, for example: control A will not be able to call a procedure from control B.
Summary table
PublicRestrictedPrivate
Access from the elementYesYesYes
Access from another element of the projectYesYesNo
Access from a third-party project via a SOAP Webservice or an external ComponentYesNoNo
Scope changes

Changing the scope of a procedure

To change the scope of a procedure or method at any time, you can do one of the following:
  • directly write the new scope in the code of the procedure or method,
  • right-click the element in the "Project explorer" pane and select the desired scope.
The scope of a procedure or method can easily be determined according to the color of the icon in the "Project explorer" pane:
  • private elements are shown in red,
  • protected elements are shown in orange,
  • public elements are shown in green.

Migrating a project from an older version to version 28 or later

A new compilation error may appear when migrating projects from version 27 and earlier to version 28. This error indicates the "PRIVATE" keyword behaves differently. Before version 28, the "Private" keyword had the same effect as the current "Restricted" keyword. When migrating a project to version 28, you may need to replace the "Private" keyword with "Restricted". A specific compilation error will help you detect the different cases in your project.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 10/24/2023

Send a report | Local help