Defining the access level

In the Prototype window, use the drop-down list labeled Access to specify where you can call the function in the application.

For global functions

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.

For object-level functions

You can restrict access to an object-level function by setting its access level.

Table 8-1: Access levels for object-level functions

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.

NoteTransaction server components If you are defining functions for a custom class user object that you will use as an EAServer or application server component, remember that only public functions can appear in the interface for the component.