Advanced PowerBuilder

HomePrevious Lesson: Access Levels - Functions
Next Lesson: Creating an Instance

Choosing Between Events and Functions

The following table lists the differences between events and functions.

Event

Function

Executing a non-existing event returns null value.

Executing a non-existing function, generates error and it has to be taken care in the error handling.

An event is always public, and can be called by any object.

You can define access levels to a function.

In the descendent object, you have the option of extending or overriding an event script.

Declaring the same function with the same interface in the descendent object always overrides the ancestor function.

When calling an event, the search starts from ancestor down to the object from where it is called.

The searching order for unqualified names is done in the following order:

Global External Functions (External functions are explained in a later session)

Global Function.

Local External Functions.

Object Level functions. (When calling a function the search starts from the descendent and upwards.)

System Function.

Events can't be overloaded.

Functions can be overloaded.

HomePrevious Lesson: Access Levels - Functions
Next Lesson: Creating an Instance