Print Page | Close Window

MDI forms- keep panes in form

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=400
Printed Date: 21 November 2024 at 3:00pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: MDI forms- keep panes in form
Posted By: aaron1
Subject: MDI forms- keep panes in form
Date Posted: 30 January 2004 at 5:35am

I am working on an MDI application and using the Dockking Pane controls. I would like to be able to:
1. Prevent users from acutally closing the Panes with the X icon. They should only be able minimize the Pane down to its icon.

2. Prevent them from tearing the Panes off of the form. Basically just to let them move them around and hide them show them. But all on the same form.

What I am trying to avoid is having multiple identical Panes from several forms torn off and floating around the main MDI document.

Thanks.




Replies:
Posted By: vladsch
Date Posted: 07 February 2004 at 11:44am

Hi Aaron:

Here are mods to MDIPanes sample so that when an MDI window is deactivated it hides its floating pane and shows it when re-activated. If the pane is not floating leaves it as is.

Not quite the restriction of not being able to float a pane but from what you described it should do the trick.

I tried these mods on the MDIPane sample app:

1. In CChildFrame::OnDockingPaneNotify after the line

pPane->Attach(&m_wndPropertyGrid);
add
pPane->SetOptions(xtpPaneNoCloseable);

This will remove the x from the docked pane and prevent it from closing. When floating the X is still there but does nothing.

2. Declare in ChildFrm.h

afx_msg void OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd);

3. In ChildFrm.cpp Add to the message map

ON_WM_MDIACTIVATE()

4. In ChildFrm.cpp Add the OnMDIActivate function:


void CChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd)
{
    CMDIChildWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);
 
    if (bActivate && m_paneManager.IsPaneClosed(IDR_PANE_PROPERTIES))
    {
         m_paneManager.ShowPane(IDR_PANE_PROPERTIES);
    }
    else if (m_paneManager.FindPane(IDR_PANE_PROPERTIES)->IsFloating( ))
    {
         m_paneManager.ClosePane(IDR_PANE_PROPERTIES);
    }
}

 




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