In the Prototype window, use the drop-down list labeled Access to specify where you can call the function in the application.
Global functions can always be called anywhere in the application. In PowerBuilder terms, they are public. When you are defining a global function, you cannot modify the access level; the field is read-only.
You can restrict access to an object-level function by setting its access level.
Access |
Means you can call the function |
---|---|
Public |
In any script in the application. |
Private |
Only in scripts for events in the object in which the function is defined. You cannot call the function from descendants of the object. |
Protected |
Only in scripts for the object in which the function is defined and scripts for that object’s descendants. |
If a function is to be used only internally within an object, you should define its access as private or protected. This ensures that the function is never called inappropriately from outside the object. In object-oriented terms, defining a function as protected or private encapsulates the function within the object.