Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - CXTPDockingPaneLayout::DoPropExchange() filtering.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPDockingPaneLayout::DoPropExchange() filtering.

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


Joined: 17 April 2012
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Andyman Quote  Post ReplyReply Direct Link To This Post Topic: CXTPDockingPaneLayout::DoPropExchange() filtering.
    Posted: 14 February 2013 at 1:25am
Hi All

When I'm saving the layout of my docking panes I want to filter out unwanted panes so that they don't get modified when I do a restore later on. In the following code snippet I'm attempting to do this. I'm creating a new pane layout object, removing the docking panes I don't want from the pane list, and then doing a property exchange on that.

CXTPPropExchangeSection pxDockingPane(pPX->GetSection(_T("DockingPane")));
if (!pPX->IsLoading ())
  {
  CXTPDockingPaneLayout *pLayout = m_paneManager.CreateLayout ();
  m_paneManager.GetLayout (pLayout);
  if (pLayout)
    {
    std::set<int> idSet;
    idSet.insert (ID_PANE_1);
    idSet.insert (ID_PANE_2);
    idSet.insert (ID_PANE_3);

    // Remove unwanted panes before exchange.
    CXTPDockingPaneInfoList cache;
    CXTPDockingPaneInfoList &paneList = pLayout->GetPaneList ();
    POSITION pos = paneList.GetTailPosition();
    while (pos)
      {
      CXTPDockingPane* pPane = paneList.GetAt (pos);
      if (idSet.find (pPane->GetID ()) != idSet.end ())
        {
        cache.AddTail (paneList.GetAt (pos));
        paneList.RemoveAt (pos);
        }
      paneList.GetPrev (pos);
      }
    pLayout->DoPropExchange (&pxDockingPane);
    delete pLayout;
    }
  }

And here is the generated layout…

<Settings CompactMode="1">
  <CustomLayout>
    <DockingPane>
      <Summary Panes="21" TopContainer="4" Client="9"/>
      <Pane-1 Type="0" DockingCX="220" DockingCY="150" Title="Forms\n" ID="40" DockingHolder="7" LastHolder="7" MinTrackX="100" MinTrackY="100"/>
      <Pane-2 Type="0" DockingCX="200" DockingCY="120" Title="MyApplication:2\n\n" ID="501" Options="16" DockingHolder="10" FloatingHolder="13" LastHolder="13"/>
      <Pane-3 Type="5" Direction="0" Panes="0"/>
      <Pane-4 Type="2" Panes="1" Pane-1="5"/>
      <Pane-5 Type="2" DockingCX="1280" DockingCY="723" Horiz="1" Panes="2" Pane-1="6" Pane-2="8"/>
      <Pane-6 Type="2" DockingCX="223" DockingCY="876" Panes="1" Pane-1="7"/>
      <Pane-7 Type="1" DockingCX="220" DockingCY="494" Panes="3" Pane-1="0" Pane-2="0" Pane-3="0"/>
      <Pane-8 Type="2" DockingCX="1178" Panes="2" Pane-1="9" Pane-2="10"/>
      <Pane-9 Type="4"/>
      <Pane-10 Type="1" DockingCX="200" DockingCY="120" Panes="0"/>
      <Pane-11 Type="3" WindowRectTopPos="49" WindowRectBottomPos="429" WindowRectLeftPos="775" WindowRectRightPos="1359" TopContaner="12"/>
      <Pane-12 Type="2" DockingCX="200" DockingCY="120" Horiz="1" Panes="1" Pane-1="13"/>
      <Pane-13 Type="1" DockingCX="200" DockingCY="120" Panes="1" Selected="2" Pane-1="2"/>
    </DockingPane>
  </CustomLayout>
</Settings>

All good so far. So now for my problem.

Loading the saved layout crashes. I think that it's because <Summary Panes="21" TopContainer="4" Client="9"/> is wrong (it is still referring to the original number of panes before I removed some of them). Unfortunately that value is retrieved from a private member in the CXTPDockingPaneLayout class so I can't change it. I guess I could just change the XML but that seems pretty hacky.

Any thoughts / ideas? Ideally I'd like to override CXTPDockingPaneLayout::_Save but obviously that has been abstracted away for good reasons.
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 865
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 11 September 2013 at 8:28am
Can you not create the cache and remove the panes and then create and save the layout?

Have you changed the xml to verify it is the count?
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.