System Interface Syntax

PowerBuilder .NET provides system interfaces that include implementations for all the methods of DataWindow controls and DataStores. You can use these system interfaces in your WPF applications or components.

You can work with system interfaces instead of individual DataWindow, DataStore, or Picture controls. Because these controls automatically implement system interfaces, you can pass the interface rather than the control, and directly call methods on the interface.

You need not declare system interfaces, or add implementations for their methods.

IDataWindowBase and its children

The IDataWindowBase system interface includes all the methods common to DataWindows and DataStores. It also is the base interface of three other system interfaces: IDataWindowControl, IDataWindowChild, and iDataStore.

You can assign any variable with a DataWindow, DataStore, or DataWindowChild datatype to the IDataWindowBase system interface. This allows you to take advantage of the interface's built-in polymorphism, so you need not duplicate code or check whether the assigned variable is a DataWindow or DataStore. The inherited system interfaces are slightly more restrictive, but can be assigned variables with the datatype indicated in this table:
System interface Variable datatype to which it can be assigned
IDataWindowBase and IDataWindowControl DataWindow
IDataWindowBase and IDataWindowChild DataWindowChild
IDataWindowBase and iDataStore DataStore
This syntax defines a function that determines the number of rows in a DataWindow or DataStore after a filter is applied:
                 public function long f_filter (IDataWindowBase idw_base, string as_filter);
                 long ll_rows

                 idw_base.SetFilter (as_filter)
                 idw_base.Filter ()

                 return idw_base.RowCount ()
                 end function
You can then call this function in a script, passing in a valid DataWindow or DataStore and the value you want to use as a filter. This script filters a DataStore on a department ID of 100:
                 DataStore ldw_emps
                	ldw_emps = Create DataStore
	                ldw_emps.DataObject = "d_myDWO"
	                ldw_emps.SetTransObject (SQLCA)	// Assumes a connected transaction
	                ldw_emps.Retrieve ()

	                this.f_Filter (ldw_emps, "dept_id = 100")

IPicture

PowerBuilder .NET also provides an IPicture interface that exposes all the common methods of the PowerBuilder picture control. This example calls the SetPicture and Draw methods on an object that inherits from the IPicture interface:
                 IPicture ip = p_1
                 ip.SetPicture (myPictureBlob)
                 ip.Draw (x, y)

The IDataWindowControl and IDataWindowChild interfaces also use the IPicture system interface to set the picturename parameter in the SetRowFocusIndicator method of a DataWindow or DataWindowChild control.