background image
<< Class Hierarchy - Defining new classes | Class Hierarchy - winclass declaration” >>
Class Hierarchy - new class called FileDialog
<< Class Hierarchy - Defining new classes | Class Hierarchy - winclass declaration” >>
314
User's Guide
16 E
XTENDING
THE
C
LASS
H
IERARCHY
Defining new classes
It is not uncommon for an application to have multiple dialogs whose only
difference is the caption: The child windows are all identical or nearly
identical. Rather than recording declarations that repeat the same child
objects, it is cleaner to create a new class that groups the common child
objects.
For example, here is the class declaration for a new class called FileDialog,
which is derived from the DialogBox class and declares each of the children
that will be inherited by the SaveAs and Open dialogs:
winclass FileDialog : DialogBox
parent TextEditor
StaticText FileNameText
tag "File Name:"
TextField FileName1
tag "File Name:"
ListBox FileName2
tag "File Name:"
window DialogBox Open
tag "Open"
parent TextEditor
StaticText FileNameText
tag "File Name:"
TextField FileName1
tag "File Name:"
ListBox FileName2
tag "File Name:"
StaticText DirectoriesText
tag "Directories:"
StaticText PathText
tag "#3"
ListBox Path
tag "#2"
StaticText ListFilesOfTypeText
tag "List Files of Type:"
PopupList ListFilesOfType
tag "List Files of Type:"
StaticText DrivesText
tag "Drives:"
PopupList Drives
tag "Drives:"
PushButton OK
tag "OK"
PushButton Cancel
tag "Cancel"
PushButton Network
tag "Network"
window DialogBox SaveAs
tag "Save As"
parent TextEditor
StaticText FileNameText
tag "File Name:"
TextField FileName1
tag "File Name:"
ListBox FileName2
tag "File Name:"
StaticText DirectoriesText
tag "Directories:"
StaticText PathText
tag "#3"
ListBox Path
tag "#2"
StaticText ListFilesOfTypeText
tag "List Files of Type:"
PopupList ListFilesOfType
tag "List Files of Type:"
StaticText DrivesText
tag "Drives:"
PopupList Drives
tag "Drives:"
PushButton OK
tag "OK"
PushButton Cancel
tag "Cancel"
PushButton Network
tag "Network"