Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Maximized MDI Child window shows outline when switching from one to another Collapse All
Subject Author Date
Saroj Acharya Mar 8, 2005 - 8:55 AM

Hi Customer Support,


I have a MDI application (Using CExtTabPageContainerFlatWnd) where I display various images in its child window. When the user opens an image, I want to open it in maximized state and keep it that way until he/she willingly chages the MDI child window. Besides, when he clicks on the tab to get to another image, I just want it to swich to another without showing the outline...


Here is my problem. When an image is opened, it will be opened in Maximized state within the MDI Frame window. However, when I click on the tab to get to the next window, I briefly see a outline of the child window before getting the maximized image. I tried lots of tricks (that I knew of) to get this outline removed but I could not do it. Could you please help me with this problem.


Regards,


Saroj

Technical Support Mar 9, 2005 - 1:52 AM

Dear Saroj,

Please try to override the ActivateFrame() virtual method of the CMDIChildWnd-derived class in your project (typically called CChildFrame) like as follows:

    void CSplitFrame::ActivateFrame( int nCmdShow ) 
    {
        nCmdShow = SW_SHOWMAXIMIZED;
        CMDIChildWnd::ActivateFrame( nCmdShow );
    }
and let us know if it is what you really need.

Saroj Acharya Mar 9, 2005 - 9:00 AM

Dear Tech Support,


I alreday have that code in my application. When the child is created it comes as a miximized window within the project but when there are multiple of them and I click on the tab to switch from one to another, I can see the outline for a fraction of second before it becomes active and of course, in Maximized state. The brief moment of time the outline appears and it is really annoying. I would like to get that resolved.


Appreciate you help.


Saroj

Technical Support Mar 9, 2005 - 11:37 AM

We may guess you encounter a bug of the standard MDI interface. It is possible to fix it. Please add message handlers for the WM_WINDOWPOSCHANGED and WM_NCPAINT windows messages to your CMDIChildWnd-derived class. Here is their implementation:

void CChildFrame::OnWindowPosChanged(
        WINDOWPOS FAR* lpwndpos
        ) 
    {
        CMDIFrameWnd * pMdiFrame =
            STATIC_DOWNCAST(
                CMDIFrameWnd,
                GetParentFrame()
                );
        ASSERT_VALID( pMdiFrame );
        BOOL bMax = FALSE;
        CMDIChildWnd * pActive =
            pMdiFrame->MDIGetActive(
                &bMax
                );
        pActive;
        if( ! bMax )
        {
            CMDIChildWnd::OnWindowPosChanged(
                lpwndpos
                );
            return;
        }
        SetRedraw( FALSE );
        CMDIChildWnd::OnWindowPosChanged(
            lpwndpos
            );
        SetRedraw( TRUE );
        RedrawWindow(
            NULL,
            NULL,
            RDW_INVALIDATE
                | RDW_ERASE
                | RDW_ALLCHILDREN
                | RDW_FRAME
            );
    }

    void CChildFrame::OnNcPaint() 
    {
        CMDIFrameWnd * pMdiFrame =
            STATIC_DOWNCAST(
                CMDIFrameWnd,
                GetParentFrame()
                );
        ASSERT_VALID( pMdiFrame );
        BOOL bMax = FALSE;
        CMDIChildWnd * pActive =
            pMdiFrame->MDIGetActive(
                &bMax
                );
        pActive;
        if( bMax )
            return;
        CMDIChildWnd::OnNcPaint();
    }