Print Page | Close Window

How to control which panes a pane can attach to?

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=16545
Printed Date: 31 January 2025 at 3:44am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to control which panes a pane can attach to?
Posted By: BenW
Subject: How to control which panes a pane can attach to?
Date Posted: 31 March 2010 at 9:45am

I am trying to keep a set of panes from attaching to a specific pane (IDR_PANE_OUTPUT_BAR).

I know this is handled by setting the bCancel member of the XTP_DOCKINGPANE_ACTION to false in the  OnDockingPaneNotify message handler when wParam is XTP_DPN_ACTION, and the action member of the XPT_DOCKINGPANE_ACTION is xtpPaneActionAttaching.  The problem I am having is determining if the pane that is going to have the new pane added already contains the IDR_PANE_OUTPUT_BAR pane.  I have the following OnDockingPaneNotify message handler:
 
Pane ID's
 
#define IDR_PANE_PROJECT 4000

#define IDR_PANE_BACKGROUND 4001

#define IDR_PANE_COORDINATES 4002

#define IDR_PANE_STACKER 4003

#define IDR_PANE_LEGEND 4004

#define IDR_PANE_VIEW_EXTENTS 4005

#define IDR_PANE_OUTPUT_BAR 4006
 

LRESULT CMainFrame::OnDockingPaneNotify(WPARAM wParam, LPARAM lParam)

{

switch (wParam) {

case XTP_DPN_SHOWWINDOW:

{

CXTPDockingPane* pPane = (CXTPDockingPane*)lParam;

if (!pPane->IsValid()) {

switch (pPane->GetID()) {

case IDR_PANE_PROJECT:

if (NULL == m_pMapObjectView) {

m_pMapObjectView = DYNAMIC_DOWNCAST(CMapObjectView,pPane->AttachView(this,RUNTIME_CLASS(CMapObjectView)));

} else {

pPane->Attach(m_pMapObjectView->GetParent());

}

break;

case IDR_PANE_BACKGROUND:

if (NULL == m_pBackgroundCtrl) {

m_pBackgroundCtrl = DYNAMIC_DOWNCAST(CBackgroundCtrl, pPane->AttachView(this,RUNTIME_CLASS(CBackgroundCtrl)));

} else {

pPane->Attach(m_pBackgroundCtrl->GetParent());

}

break;

case IDR_PANE_LEGEND:

if (NULL == m_pLegendCtrl) {

m_pLegendCtrl = DYNAMIC_DOWNCAST(CLegendCtrl,pPane->AttachView(this,RUNTIME_CLASS(CLegendCtrl)));

} else {

pPane->Attach(m_pLegendCtrl->GetParent());

}

break;

case IDR_PANE_STACKER:

if (NULL == m_pStackerCtrl) {

m_pStackerCtrl = DYNAMIC_DOWNCAST(CStackerCtrl,pPane->AttachView(this,RUNTIME_CLASS(CStackerCtrl)));

} else {

pPane->Attach(m_pStackerCtrl->GetParent());

}

break;

case IDR_PANE_COORDINATES:

if (NULL == m_pCoordinateCtrl) {

m_pCoordinateCtrl = DYNAMIC_DOWNCAST(CCoordinateCtrl,pPane->AttachView(this,RUNTIME_CLASS(CCoordinateCtrl)));

} else {

pPane->Attach(m_pCoordinateCtrl->GetParent());

}

break;

case IDR_PANE_VIEW_EXTENTS:

if (NULL == m_pViewExtentsCtrl) {

m_pViewExtentsCtrl = DYNAMIC_DOWNCAST(CViewExtentsCtrl,pPane->AttachView(this,RUNTIME_CLASS(CViewExtentsCtrl)));

} else {

pPane->Attach(m_pViewExtentsCtrl->GetParent());

}

break;

case IDR_PANE_OUTPUT_BAR:

if (NULL == m_pOutputBar) {

m_pOutputBar = new COutputBarD(this);

}

if (0 == m_pOutputBar->GetSafeHwnd()) {

m_pOutputBar->Create(this);

}

pPane->Attach(m_pOutputBar);

break;

}

}

return true;

}

break;

case XTP_DPN_ACTION:

{

XTP_DOCKINGPANE_ACTION* pAction = (XTP_DOCKINGPANE_ACTION*)lParam;

UINT nID = pAction->pPane->GetID();

switch (pAction->action) {

case xtpPaneActionAttaching:

{

TRACE("Action Pane %d\n",nID);

TRACE("Dock Container Type %s\n",strPaneType[pAction->pDockContainer->GetType()]);

if  (IDR_PANE_OUTPUT_BAR == nID)  {

pAction->bCancel = true;

return true;

} else if ((IDR_PANE_PROJECT <= nID) && (IDR_PANE_VIEW_EXTENTS >= nID)) {

if (xtpPaneTypeTabbedContainer == pAction->pDockContainer->GetType()) {

CXTPDockingPaneTabbedContainer *tc = (CXTPDockingPaneTabbedContainer*)pAction->pDockContainer;

// if docking site contains IDR_PANE_OUTPUT_BAR or any pane other than IDR_PANE_PROJECT,
// IDR_PANE_BACKGROUND, IDR_PANE_COORDINATES, IDR_PANE_STACKER, IDR_PANE_LEGEND,
// IDR_PANE_VIEW_EXTENTS pAction->bCancel = true;
// Can't figure out what to do here,  the provided documentation is minimal
}

} else {

// keep rest of panes from attaching to any other pane
pAction->bCancel=true;
}
 
pAction->bCancel=FALSE;

return true;

}

break;

}

return true;

}

break;

}

return false;

}



-------------
Product: Xtreme ToolkitPro (MFC) version 13.3.1
Platform: Windows XP (32bit) - SP 3
Visual Studio: 2008
Language: Visual C++ Unmanaged




Replies:
Posted By: BenW
Date Posted: 06 April 2010 at 2:27pm
 I Figured it out,  here's the code
 

case XTP_DPN_ACTION:

{

XTP_DOCKINGPANE_ACTION* pAction = (XTP_DOCKINGPANE_ACTION*)lParam;

UINT nID = pAction->pPane->GetID();

if (xtpPaneActionAttaching == pAction->action) {

if ((IDR_PANE_PROJECT <= nID) && (IDR_PANE_VIEW_EXTENTS >= nID)) {

if (xtpPaneTypeTabbedContainer == pAction->pDockContainer->GetType()) {

CXTPDockingPaneTabbedContainer *tc = (CXTPDockingPaneTabbedContainer*)pAction->pDockContainer;

CXTPDockingPane *fp = (CXTPDockingPane*)tc->GetFirstPane();

UINT pID = fp->GetID();

if ((IDR_PANE_PROJECT <= pID) && (IDR_PANE_VIEW_EXTENTS >= pID)) {

pAction->bCancel = false;

} else {

pAction->bCancel = true;

}

}

} else {

pAction->bCancel = true;

}

return true;

}

}

break;




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