OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Constructing Child Windows

As with all interface objects, child-window objects get created in two steps: constructing the interface object and creating the interface element.

If you construct child-window objects in the constructor of the parent window, their interface elements are automatically created when the parent is, assuming that automatic creation is enabled for the child windows. By default, automatic creation is enabled for all ObjectWindows objects based on TDialog, with the exception of TDialog.

For example, the constructor for a window object derived from TWindow that contains three button child windows would look like this:

TTestWindow::TTestWindow(TWindow *parent, const char far *title)
{
Init(parent, title);
button1 = new TButton(this, ID_BUTTON1, "Show", 190, 270, 65, 20, false);
button2 = new TButton(this, ID_BUTTON2, "Hide", 275, 270, 65, 20, false);
button3 = new TButton(this, ID_BUTTON3, "Transfer", 360, 270, 65, 20, false);
}

Note the use of the this pointer to link the child windows with their parent. Interface object constructors automatically add themselves to their parents' child window lists. When an instance of TTestWindow is created, the three buttons are automatically displayed in the window.

See Also