|
|
|
|
|
- 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
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: 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 processing or event in 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 a visible entry point to the Webservice). - Private procedure The procedure cannot be used from another element of the project (procedure collections, 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 throughout the project, but cannot be exported to a web service or external component.
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 an external component or SOAP web service is generated.
- Restricted method The class method can be used in all project elements, but is not exported to external components or SOAP web services.
- Protected method the method is accessible within the class code and derived classes only. The method is exported when an external component or SOAP web service is generated.
- Restricted protected method Restricted protected method: the limitation is identical to the "protected" scope, but the method will not be exported when an external component or SOAP web service is generated.
- Private method The method is accessible only within the code of the current class.
- Abstract method An abstract method is a method that must be redefined in derived classes.
- Global method the method won't work on a specific object: you don't need an object of the class to call this method.
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. For example, this allows you to isolate code and avoid abusive calls: an A field cannot call a procedure from a B field. New in version 2025Note: A local procedure can be reactive. For more details, see Reactive procedures. | | | | | Public | Restricted | Private | Access from the element | Yes | Yes | Yes | Access from another element of the project | Yes | Yes | No | Access from a third-party project via a SOAP web service or an external component | Yes | No | No |
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.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|