Using inheritance to build user objects
Contents
When you build a user object that inherits its definition
(properties, events, functions, structures, variables, controls, and
scripts) from an existing user object, you save coding time. All you
must do is modify the inherited definition to meet the requirements of
the current application.
For example, suppose your application has a user object
u_file_view that has three CommandButtons:
-
List—displays a list of files in a list
-
Open—opens the selected file and displays the file in a
MultiLineEdit control -
Close—displays a message box and then closes the window
If you want to build another user object that is exactly like the
existing u_file_view except that it has a fourth CommandButton, you can
use inheritance to build the new user object, and then all you need to
do is add the fourth CommandButton.
To use inheritance to build a descendant user object:
-
Click the Inherit button in the PowerBar, or select
File>Inherit from the menu bar. -
In the Inherit From Object dialog box, select User Objects
from the Objects of Type drop-down list. -
Select the target as well as the library or libraries you want
to look in.Displaying user objects from many libraries
To find a user object more easily, you can select more than
one library in the Libraries list. Use Ctrl+click to toggle
selected libraries and Shift+click to select a range. -
Select the user object you want to use to create the
descendant, and click OK.The selected object displays in the User Object painter and
the title bar indicates that the object is a descendant. -
Make any changes you want to the user object.
-
Save the user object with a new name.