Creating MDI child manually 
Author Message
 Creating MDI child manually

Hi,

I'm new to MFC and is still trying to grasp the Doc/View concept.  I
have created an MDI app through the AppWizard in VC++ 6.0 (SP 5). When
I run the program and click on the "New" button, a new MDI child
window gets created.  It seems that the code is hidden away and I
can't get to it.

My question is: How do I create the MDI child manually, through code.
I understand that you do this through the CreateNewFrame() function.
What I'm also not clear on is that by clicking on the "New" button
that many times generate that many MDI child windows.  But there is
only one CChildFrm class, so are all those MDI childs just instances
of the CChildFrm class?

What I am trying to do is just create two buttons on the tool bar,
let's say one button is to display some graphics, the other button to
display some text.  When I click on the button for graphics, an MDI
window will open and display some images, while clicking the other
button opens a new MDI window and have some text display in there.

Do I need to create new classes and derive them from CDocument and
CView to hold the actual data (the graphics and texts) that I am going
to display?

Any help would be appreciated.

Steven



Sat, 05 Nov 2005 22:51:50 GMT  
 Creating MDI child manually

Quote:
> But there is only one CChildFrm class, so are all those MDI childs just
instances
> of the CChildFrm class?

Yes

Quote:
> When I click on the button for graphics, an MDI
> window will open and display some images, while clicking the other
> button opens a new MDI window and have some text display in there.

You would need to have a doctemplate for each type of view(graphics/text).
Then in the handler of your toolbar buttons, you would use the appropriate
doctemplate to call CreateNewFrame.

--
Ajay Kalra [MVP - VC++]


Quote:
> Hi,

> I'm new to MFC and is still trying to grasp the Doc/View concept.  I
> have created an MDI app through the AppWizard in VC++ 6.0 (SP 5). When
> I run the program and click on the "New" button, a new MDI child
> window gets created.  It seems that the code is hidden away and I
> can't get to it.

> My question is: How do I create the MDI child manually, through code.
> I understand that you do this through the CreateNewFrame() function.
> What I'm also not clear on is that by clicking on the "New" button
> that many times generate that many MDI child windows.  But there is
> only one CChildFrm class, so are all those MDI childs just instances
> of the CChildFrm class?

> What I am trying to do is just create two buttons on the tool bar,
> let's say one button is to display some graphics, the other button to
> display some text.  When I click on the button for graphics, an MDI
> window will open and display some images, while clicking the other
> button opens a new MDI window and have some text display in there.

> Do I need to create new classes and derive them from CDocument and
> CView to hold the actual data (the graphics and texts) that I am going
> to display?

> Any help would be appreciated.

> Steven



Sun, 06 Nov 2005 02:06:40 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to create an MDI App without an initial MDI Child opening by the framework

2. Opening a new MDI child when no MDI Child exists

3. Opening a new MDI child from a MDI Child

4. How develop MDI application with child forms like VB MDI and Child forms

5. Creating Borderless Child Windows in an MDI application

6. Creating MDI child windows without focus

7. problems creating child windows in MDI

8. creating a dockable child inside a MDI window ??!!?!?

9. Creating MDI children given an app's main hWnd

10. Creating Child Window in MDI App.??

11. How to create maximized MDI child window?

12. Desktop flashes when MDI child frame is created or moved

 

 
Powered by phpBB® Forum Software