Problem loading layouts for docking panes |
Post Reply |
Author | |
Aaron Koolen
Groupie Joined: 22 July 2009 Status: Offline Points: 32 |
Post Options
Thanks(0)
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 |
|
Aaron Koolen
Groupie Joined: 22 July 2009 Status: Offline Points: 32 |
Post Options
Thanks(0)
|
Further to this, it seems that I have managed to get the crash consistently happening here:
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 |
|
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 886 |
Post Options
Thanks(0)
|
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(); { 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(); |
|
Aaron Koolen
Groupie Joined: 22 July 2009 Status: Offline Points: 32 |
Post Options
Thanks(0)
|
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 |
|
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 886 |
Post Options
Thanks(0)
|
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).
|
|
elmue
Groupie Joined: 05 June 2010 Location: Germany Status: Offline Points: 24 |
Post Options
Thanks(0)
|
> 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ü |
|
elmue
Groupie Joined: 05 June 2010 Location: Germany Status: Offline Points: 24 |
Post Options
Thanks(0)
|
Meanwhile I found the cause for my crashes:
http://forum.codejock.com/forum_posts.asp?TID=16969&PID=59371#59371 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |