Implementing an Interface

To use the functionality of an interface, create a class that implements the interface, or derive a class from one of the .NET Framework classes that implements the interface.

These types of PowerBuilder .NET objects can implement interfaces: custom class, standard class, custom visual, external visual, standard visual, window, and menu objects.

If an object class implements two interfaces that contain a member with the same signature, implementing that member in the class implements that member for both interfaces. Naming or identity conflicts are resolved by including the name of the interface with the name of the class member, separated by a dot.

Note: .NET rules do not allow you to directly call an identical member of two interfaces on a class that implements those interfaces. You must use a variable of one of the implemented interface types to call the member. If you try to call the member on the implementing class, PowerBuilder .NET displays a compilation error.
  1. Open the painter for an object that can implement interfaces.
  2. Select Declare from the drop-down list at the top left of the painter, then select Interfaces from the second drop-down list.
  3. Right-click in the Interface list box and select Add Interface.
  4. From the Select Interface dialog box, select the interface to implement and click OK.
  5. Write scripts for all interface events, functions, .NET properties, and indexers.
  6. Save the object with its interface implementations.
    You can view the object and the interfaces it implements in the the PB Object Outline view.