The declarations for the controls contained by a dialog box are nested within the declaration of the dialog box to show the GUI hierarchy.
The declarations for menus are nested (indented) within the declaration for the main window, and the declarations for the menu items are nested within their respective menus. This nesting denotes the hierarchical structure of the GUI, that is, the parent-child relationships between GUI objects. Although a dialog box is not physically contained by the main window, as is true for menus, the dialog box nevertheless logically belongs to the main window. Therefore, a parent statement within each dialog box declaration is used to indicate that it belongs to the main window of the application.
In the sample Text Editor application, MainWin is the parent of the File menu. The File menu is considered a child of the MainWin. Similarly, all the menu items are child objects of their parent, the File menu. A child object belongs to its parent object, which means that it is either logically associated with the parent or physically contained by the parent.
Because child objects are nested within the declaration of their parent object, the declarations for the child objects do not need to begin with the reserved word window.
The following example from the Text Editor application shows the declarations for the Find dialog box and its contained controls:
window DialogBox Find tag "Find" parent TextEditor StaticText FindWhatText multitag "Find What:" "$65535" TextField FindWhat multitag "Find What:" "$1152" CheckBox CaseSensitive multitag "Case sensitive" "$1041" StaticText DirectionText multitag "Direction" "$1072" RadioList Direction multitag "Direction" "$1056" PushButton FindNext multitag "Find Next" "$1" PushButton Cancel multitag "Cancel" "$2"
window DialogBox Find locator "Find" parent TextEditor TextField FindWhat locator "@caption='Find What:' or @windowId='65535'" StaticText FindWhatText locator "@caption='Find What:' or @windowId='1152'" CheckBox CaseSensitive locator "@caption='Case sensitive' or @windowId='1041'" StaticText DirectionText locator "@caption='Direction' or @windowId='1072'" RadioList Direction locator "@caption='Direction' or @windowId='1056'" PushButton FindNext locator "@caption='Find Next' or @windowId='1'" PushButton Cancel locator "@caption='Cancel' or @windowId='2'"