OWLNext 7.0
Borland's Object Windows Library for the modern age
|
There are two ways to create MDI child windows: automatically in TMDIClient::InitChild() or manually elsewhere.
TMDIClient defines the TMDIClient::CmCreateChild() message response function to respond to the CM_CREATECHILD message. CmCreateChild is commonly used to respond to an MDI application's File|New menu command. CmCreateChild calls TMDIClient::CreateChild(), which calls TMDIClient::InitChild() to construct an MDI child window object, and finally calls the child object's Create member function to create the MDI child window interface element.
If your MDI application uses CM_CREATECHILD as the command ID to create new MDI child windows, then you should override InitChild in your MDI client window class to construct MDI child window objects whenever the user chooses that command, as follows:
Since TMDIChild's constructor takes a reference to its parent window object and not a pointer, you need to dereference the this pointer.
You do not have to construct MDI child window objects in InitChild. If you construct them elsewhere, however, you must create the interface element yourself: