Print Page | Close Window

Problem restoring pane positions

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=5397
Printed Date: 12 December 2024 at 7:57am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Problem restoring pane positions
Posted By: ContactGT
Subject: Problem restoring pane positions
Date Posted: 01 November 2006 at 6:56am

I have worked through the "Add a Docking Pane to your application" tutorial and everything is working perfectly, except for the restore of Pane positions...

In my MainFrame class I have lines of code like this (for each pane) of these in my header file:

    CXTPDockingPane *pwndProjList;
    ProjectListTabCtrl  m_wndProjectListWindow;

And in my OnCreate() method (above the code to restore the layout) I have a number of lines of code like this (for each pane):

    pwndProjList = m_paneManager.CreatePane(IDR_PANE_PROJLIST, CRect(0, 0,200, 250), xtpPaneDockBottom);
    m_wndProjectListWindow.Create(TCS_TABS | TCS_FIXEDWIDTH | WS_CHILD | WS_VISIBLE, CRect(0,0,0,0), this, IDGT_PROJ_LIST_WND);
    pwndProjList->Attach(&m_wndProjectListWindow);


This creates a pane containing a list control.


I have added the following code to my OnCreate() method after the above code:

    // Load the previous state for docking panes.
    CXTPDockingPaneLayout layoutNormal(&m_paneManager);
    if (layoutNormal.Load(_T("NormalLayout")))
    {
        m_paneManager.SetLayout(&layoutNormal);
    }


And in my OnClose method I have added the following code:

    // Save the current state for docking panes.
    CXTPDockingPaneLayout layoutNormal(&m_paneManager);
    m_paneManager.GetLayout(&layoutNormal);
    layoutNormal.Save(_T("NormalLayout"));


If I include the layoutNormal code above, then the panes move to exactly where I left them, but their contents all disappear (all panes just go grey). If I remove the layoutNormal code, then the panes have content, but appear in the default positions (obviously). Am I going about restoring the pane positions in the wrong way? How do I get my content to display back?



Replies:
Posted By: rmercer
Date Posted: 01 November 2006 at 9:16am
Originally posted by ContactGT ContactGT wrote:

I have worked through the "Add a Docking Pane to your application" tutorial and everything is working perfectly, except for the restore of Pane positions...

In my MainFrame class I have lines of code like this (for each pane) of these in my header file:

    CXTPDockingPane *pwndProjList;
    ProjectListTabCtrl  m_wndProjectListWindow;

And in my OnCreate() method (above the code to restore the layout) I have a number of lines of code like this (for each pane):

    pwndProjList = m_paneManager.CreatePane(IDR_PANE_PROJLIST, CRect(0, 0,200, 250), xtpPaneDockBottom);
    m_wndProjectListWindow.Create(TCS_TABS | TCS_FIXEDWIDTH | WS_CHILD | WS_VISIBLE, CRect(0,0,0,0), this, IDGT_PROJ_LIST_WND);
    pwndProjList->Attach(&m_wndProjectListWindow);


This creates a pane containing a list control.


I have added the following code to my OnCreate() method after the above code:

    // Load the previous state for docking panes.
    CXTPDockingPaneLayout layoutNormal(&m_paneManager);
    if (layoutNormal.Load(_T("NormalLayout")))
    {
        m_paneManager.SetLayout(&layoutNormal);
    }


And in my OnClose method I have added the following code:

    // Save the current state for docking panes.
    CXTPDockingPaneLayout layoutNormal(&m_paneManager);
    m_paneManager.GetLayout(&layoutNormal);
    layoutNormal.Save(_T("NormalLayout"));


If I include the layoutNormal code above, then the panes move to exactly where I left them, but their contents all disappear (all panes just go grey). If I remove the layoutNormal code, then the panes have content, but appear in the default positions (obviously). Am I going about restoring the pane positions in the wrong way? How do I get my content to display back?
Do you also have an OnDockingPaneNotify handler to process XTP_DPN_SHOWWINDOW ?
 
Based off your example it would be something along the lines of:
 
 
LRESULT CMainFrame::OnDockingPaneNotify(WPARAM wParam, LPARAM lParam)
{
  if (wParam == XTP_DPN_SHOWWINDOW)
  {
    CXTPDockingPane *p_pane = (CXTPDockingPane*)lParam;
 
    if (!p_pane->IsValid())
    {
      switch (p_pane->GetID())
      {
        case IDR_PANE_PROJLIST:
          p_pane->Attach((CWnd*)&m_wndProjectListWindow);
          break;
 
      }
 
    }
    return TRUE;
 
  }
  return FALSE;
 
}
 



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