15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Maximize first MDI child

B Chandra Sekhar -- int@pacific.net.sg
Thursday, August 29, 1996

In my MDI application, I want the main window to be maximized and the first
MDI child window to be created with the size of the client area of the 
CMDIFrameWnd. If I use rectDefault to create the MDI Child and then maximize it,
then when the next MDI child window is created, the first one gets resized to 
rectDefault. I always want the first MDI Child window to be maximized, so I 
think that while creation itself, I have to create it with the max size i.e. 
the client area of the MDI Frame. How should I do this ?

Environment : VC++ 4.0, Windows 95

Thanks
Srini




Jim Leavitt -- jimll@halcyon.com
Saturday, August 31, 1996


Srini Wrote:
In my MDI application, I want the main window to be maximized and the first
MDI child window to be created with the size of the client area of the 
CMDIFrameWnd. If I use rectDefault to create the MDI Child and then maximize it,
then when the next MDI child window is created, the first one gets resized to 
rectDefault. I always want the first MDI Child window to be maximized, so I 
think that while creation itself, I have to create it with the max size i.e. 
the client area of the MDI Frame. How should I do this ?

Environment : VC++ 4.0, Windows 95

Thanks
Srini

Srini:
Easy...
Override  void CChildFrame::ActivateFrame(int nCmdShow)
where CChildFrame is the class of your mdi child frame window.

Example:
void CChildFrame::ActivateFrame(int nCmdShow)
{
   if (nCmdShow == -1)
       nCmdShow = SW_SHOWMAXIMIZED;

   CMDIChildWnd::ActivateFrame(nCmdShow);
}
(You may want to put in a test for the 'first' window, as this stands now, it will maximize every CChildFrame it shows.)

Jim Leavitt




PP mail system -- LAWSONW@sydney.ccur.com
Monday, September 02, 1996

G'day!
In any MDI application I run, maximizing Window "n" has no
effect on a maximized Window 1  --  it does not resize.  Are you
certain you aren't doing something to the sizing elsewhere?  An
inappropriate SetWindowPlacement?         Regards,  Jim LW



Prakash N -- pran@wings.xko.dec.com
Monday, September 02, 1996

Hello!

In Jim Leavitt's reply, he has told that the ActivateFrame() of Child =
window will test for nCmdShow. But, if you put it in CChildFrame class, =
it may not work. Since the value of nCmdShow is set to -1 every time the =
window is created, everytime the new window will be maximized regardless =
of the size of the existing children windows.

Probably, you may do the following:

Declare a flag in your CWinApp class and set it to TRUE in the App =
constructor. In your ChildFrame::ActivateFrame(), check this flag for =
TRUE and if it is so, set nCmdShow to SW_SHOWMAXIMIZED and otherwise, =
leave its value as it is.  This will work exactly like what you want in =
your MDI application.

Cheers,
Prakash
DEC India,
Bangalore
pran@wings.xko.dec.com

----------
From: 	PP mail system[SMTP:LAWSONW@sydney.ccur.com]
Sent: 	Monday, September 02, 1996 3:24 PM
To: 	int@pacific.net.sg
Cc: 	mfc-l@netcom.com
Subject: 	Re: Maximize first MDI child

G'day!
In any MDI application I run, maximizing Window "n" has no
effect on a maximized Window 1  --  it does not resize.  Are you
certain you aren't doing something to the sizing elsewhere?  An
inappropriate SetWindowPlacement?         Regards,  Jim LW




| Вернуться в корень Архива |