Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - Problem loading layouts for docking panes
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Problem loading layouts for docking panes

 Post Reply Post Reply
Author
Message
Aaron Koolen View Drop Down
Groupie
Groupie


Joined: 22 July 2009
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Koolen Quote  Post ReplyReply Direct Link To This Post Topic: Problem loading layouts for docking panes
    Posted: 02 October 2009 at 12:36am
Hi all. Wondering if anyone can shed some light here.

I have an application that creates docking panes. They are attached and sit inside my own pane which has a pane manager. I can add, delete, tear off and dock the panes fine, all is well.

I now need to serialise the layout and restore it later and things just aren't working - my application crashes. I'm at a bit of a loss on how to solve this issue.

When my application starts up, it's sent a message from a server to add docking panes. It then creates those panes, and on the UINotify for the pane, creates the window inside it that has my controls. It then attaches it to the pane.

After all the panes and internal windows are created, I load the layout with the simple LoadFromFile and SetLayout. It's saved with the corollary SaveToFile and the XML all looks good.

What do I need to ensure before calling SetLayout and what is the process required for it to work?

Thanks
Aaron


To mods: Do we have to have moderated posts? Because of my geographical location the lag in replies is quite large.
Product: Xtreme ToolkitPro v13.3.0 (MFC)
Platform: Windows XP (32bit) - SP 3
Language: Visual C++ 6
Back to Top
Aaron Koolen View Drop Down
Groupie
Groupie


Joined: 22 July 2009
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Koolen Quote  Post ReplyReply Direct Link To This Post Posted: 07 October 2009 at 5:49pm
Further to this, it seems that I have managed to get the crash consistently happening here:


void CXTPDockingPaneTabbedContainer::ShowPane(CXTPDockingPane* pPane, BOOL bSetFocus)
{
     ASSERT(pPane);

     if (m_pParentContainer && m_pParentContainer->GetType() == xtpPaneTypeAutoHidePanel)
     {

in XTPDockingPaneTabbedContainer.cpp.

The value of m_pParentContainer is coming out as 0xfeeefeee.

Remember, if I don't load my layout, the panes and everything are constructed with initial layout all fine without problems at all. It's the loading of the layout and then setting of it that gets into this state.



Product: Xtreme ToolkitPro v13.3.0 (MFC)
Platform: Windows XP (32bit) - SP 3
Language: Visual C++ 6
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 770
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 13 October 2009 at 9:57am
The value 0xfeeefeee is an indication that the tabbed container has been deleted from memory. Put the entire object in the watch window and you will see that pattern throughout the instance data (set the data view mode to "hex"). Or put the pointer in one of the memory watch windows to see the pattern floods the entire instance data.
 
So what you can do is find the m_pParentContainer's address value BEFORE you do your operation and add a data breakpoint that trips when the data changes OR simply set a breakpoint in the tabbed container's destructor. That will allow you to trap what causes the container to go bad. I suspect you are holding onto the pointer yourself. You should probably get the pointer dynamically and not store it. You will find that SetLayout is wiping out the current pane layout, which causes your object to be deleted (and a new one allocated).
 
Use:
 
pPane->GetContainer();
 
when you need the container.
 
Also, get the docking pane manager from the frame window, and the pane from the pane manager. You don't want to directly store any of these pointers yourself. If you don't use the CJ frame window, you can allocate, addref and store the pane manager but don't directly store the other pointer(s)
 

pPaneMgr = pFrameWnd->GetDockingPaneManager();

 

if (layout.Load((LPCSTR)strLayout))

pPaneMgr->SetLayout(&layout);
 
// If you know the ID of a pane you want:
pPane = pPaneMgr->FindPane(nID);
if( pPane )
{
pContainer = pPane->GetContainer()
.
.
.
 
// else spin thru the panes

CXTPDockingPaneInfoList& PaneList = pPaneMgr->GetPaneList();

for (POSITION pos = PaneList.GetHeadPosition(); pos; )

{

if (CXTPDockingPane* pPane = PaneList.GetNext(pos))

{

pContainer = pPane->GetContainer();
Back to Top
Aaron Koolen View Drop Down
Groupie
Groupie


Joined: 22 July 2009
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Koolen Quote  Post ReplyReply Direct Link To This Post Posted: 14 October 2009 at 5:40pm
Thanks RDHD, I have managed to sort out the layout problem and things are working well now.

Just need to find out how to highlight the title bar of a pane programatically. I want to do this when a user clicks in a window attached to the pain. Select(), Focus() etc just don't do it. Without it there's no way to see which one's currently selected.
Product: Xtreme ToolkitPro v13.3.0 (MFC)
Platform: Windows XP (32bit) - SP 3
Language: Visual C++ 6
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 770
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 16 October 2009 at 9:57am
When I click a title bar, it highlights. Same thing when I click a tab to show a pane that is not selected. Find the display code and see what flag bit is set to cause the highlight and then see where the bit is set (I'm guessing there is a #define for it).
Back to Top
elmue View Drop Down
Groupie
Groupie


Joined: 05 June 2010
Location: Germany
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote elmue Quote  Post ReplyReply Direct Link To This Post Posted: 17 July 2010 at 12:07pm
> I have managed to sort out the layout problem and things are working well now

Hello Aaron

It would be nice if you post your solution because you are not the only one who has this problem !

Elmü
Back to Top
elmue View Drop Down
Groupie
Groupie


Joined: 05 June 2010
Location: Germany
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote elmue Quote  Post ReplyReply Direct Link To This Post Posted: 17 July 2010 at 8:14pm
Meanwhile I found the cause for my crashes:

http://forum.codejock.com/forum_posts.asp?TID=16969&PID=59371#59371
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.033 seconds.