Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - Problem restoring pane positions
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Problem restoring pane positions

 Post Reply Post Reply
Author
Message
ContactGT View Drop Down
Newbie
Newbie


Joined: 30 October 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote ContactGT Quote  Post ReplyReply Direct Link To This Post Topic: Problem restoring pane positions
    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?
Back to Top
rmercer View Drop Down
Groupie
Groupie


Joined: 22 February 2006
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote rmercer Quote  Post ReplyReply Direct Link To This Post 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;
 
}
 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.