OWLNext 7.0
Borland's Object Windows Library for the modern age
|
You can use autocreation to let ObjectWindows do the work of explicitly creating your child dialog objects for you.
By creating the objects in the constructor of a TDialog-derived class and specifying the this pointer as the parent, the TWindow-derived class builds a list of child windows. You can produce the same behavior if you make the dialog box object a data member of the parent class. Then, when the TWindow-derived class is created, it attempts to create all the children in its list that have the wfAutoCreate flag turned on, resulting in the children appearing on the screen at the same time as the parent window.
Turn on the wfAutoCreate flag using the function EnableAutoCreate. Turn off the wfAutoCreate flag using the function DisableAutoCreate. TWindow uses Create for autocreating its children. Thus any dialog boxes created with autocreation are modeless dialog boxes.
Just as with regular modeless dialog boxes, if you are using autocreation to turn your dialog boxes on, you must make your dialog box visible; however, with autocreation you must turn the WS_VISIBLE flag on in the resource file. You cannot use the ShowWindow function to enable autocreation.
The following code shows how to enable autocreation for a dialog box:
When you execute this application, the dialog box is automatically created for you.