Print Page | Close Window

MDI children always maximized?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=6554
Printed Date: 21 May 2024 at 7:17am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: MDI children always maximized?
Posted By: znakeeye
Subject: MDI children always maximized?
Date Posted: 03 March 2007 at 1:26am
Hi,
 
How do I make sure that all MDI children inside a
CXTPTabClientWnd are always maximized - no matter what?
 
I have tried to override both PreCreateWindow and ActivateFrame:
 
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
    cs.style &= ~(WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
    if (!CMDIChildWnd::PreCreateWindow(cs))
        return FALSE;
    return TRUE;
}
void CChildFrame::ActivateFrame(int nCmdShow /* = -1 */)
{
    nCmdShow = SW_SHOWMAXIMIZED;
    CMDIChildWnd::ActivateFrame(nCmdShow);
}
 
This works until the user preses the close button of one of the MDI frames. Then the remaining children are restored!
 
Any ideas? Thanks.



Replies:
Posted By: znakeeye
Date Posted: 03 March 2007 at 2:19am
After reading https://forum.codejock.com/forum_posts.asp?TID=226 - https://forum.codejock.com/forum_posts.asp?TID=226  I found the optimal solution:
 
Just like Oleg writes, do this in CMainFrame::OnCreate():
pCommandBars->GetMenuBar()->SetFlags(xtpFlagHideMinimizeBox | xtpFlagHideMaximizeBox);
 
Then add this in each child frame:
 
void CChildFrame::ActivateFrame(int nCmdShow /* = -1 */)
{
    nCmdShow = SW_SHOWMAXIMIZED;
    CMDIChildWnd::ActivateFrame(nCmdShow);
}
 
Lol... it's always like this. You google like a freak and you find nothing. Then you post the question somewhere, and in the next couple of minutes you stumble upon the solution.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net