Print Page | Close Window

Create XML layot for RC

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=3634
Printed Date: 21 May 2024 at 3:11am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Create XML layot for RC
Posted By: Tanya
Subject: Create XML layot for RC
Date Posted: 09 February 2006 at 4:55am

Hello,

 

I want to load few pane layots from RC.

 

I used SaveToFile() to create xml files.

 

Then I added files to resources and trying to load it within LoadFromNode().

But it failed.

 

Am I doing something wrong?

 

Thank you!

Tanya




Replies:
Posted By: Oleg
Date Posted: 09 February 2006 at 1:18pm

Hello,

please show code you tring. 

Check Pane sample - OnLoadFromResource show how to load it from resource.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Tanya
Date Posted: 10 February 2006 at 12:26am

Hi Oleg,

 

I am not at work right now,but it was exactly the sample I used.

I just did a copy of this function and it fails on LoadFromNode().

I think the question is - how to create XML in a correct format.

I used SaveToFile() function ( as in Pane sample ) for creation.

It works great with LoadFromFile(), but not with LoadFromNode().

When I opened XML file from the sample RC and another XML

from SaveToFile() (even from the same sample), I saw different formats.

(I work on WinXP vs2003 )

 

 

Thank you,

Tanya



Posted By: Oleg
Date Posted: 10 February 2006 at 1:15am

Hello,

Format not a problem - XMLPropExchange supports both formats.

guesss you forgot something - may be you copied code from sample and not changed main node name -

if (pLayout->LoadFromNode(xmlRootPtr, _T("Common")))
{
   GetDockingPaneManager()->SetLayout(pLay out);
}

 

check that instead of "Common" you have main root of your XML.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Oleg
Date Posted: 10 February 2006 at 1:29am

Just tried to reproduce and think the problem was in

xmlDocPtr->get_documentElement(&xmlRootPtr);

that returns incorrect node.

try this code instead:

 LPCTSTR lpszResourceName = MAKEINTRESOURCE(IDR_SPIRAL);

 HINSTANCE hInst = AfxGetInstanceHandle();
 HRSRC hRsrc = ::FindResource(hInst, lpszResourceName, RT_HTML);
 if (hRsrc == NULL)
  return ;

 HGLOBAL hGlobal = LoadResource(hInst, hRsrc);
 if (hGlobal == NULL)
  return ;

 LPCSTR pData = (LPCSTR)LockResource(hGlobal);
 if (pData == NULL)
  return ;

 CXTPPropExchangeXMLNode px(TRUE, NULL, _T("DockingPaneLayouts"));
 if (px.LoadFromString((BSTR)_bstr_t(pData)))
 {
  CXTPDockingPaneLayout* pLayout = m_bEditor? m_pEditorLayout: m_pRunLayout;
  CXTPPropExchangeSection pxCommon(px.GetSection(_T("Common")));

  if (pLayout->DoPropExchange(&pxCommon))
  {
   GetDockingPaneManager()->SetLayout(pLay out);
  }

 }

 UnlockResource(hGlobal);
 FreeResource(hGlobal);

 

 



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Tanya
Date Posted: 10 February 2006 at 3:00pm

Oleg,

Thank you very-very much for your help!

It works perfect with your changes!

 

Tanya

 



Posted By: Tanya
Date Posted: 28 February 2006 at 6:57am

Hi Oleg,

I have a bug from our QA :(

This function doesn't work on Win2000 sp4.

Load and Save to xml-file works OK.

Load and Save to registry also.

Only the resource problem.

Please see if you can help.

 

Thanks,

Tanya



Posted By: Oleg
Date Posted: 28 February 2006 at 11:54am

Hello,

I just tried modify our pane sample

https://forum.codejock.com/uploads/oleg/2006-02-28_115238_PaneSample.zip - 2006-02-28_115238_PaneSample.zip

 

and don't see problem with win 2000,

can you please ask your QA to test our attached sample if it has problem with Windows 2000

 



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Tanya
Date Posted: 01 March 2006 at 5:34am

Hi Oleg,

I tried to run this sample on the same computer.
It doesn't work.

But on another 2000 it was OK.
So I tried to find a difference.
On a good one I saw installed -

Microsoft .NET Framework SDK v1.1

So I installed it on a bad. And problem was fixed.

But our product doesn't request SDK.
Please see if you can help.

Thanks,
Tanya



Posted By: Oleg
Date Posted: 01 March 2006 at 7:39am

Do you use Visual Studio 2003 to compile it?



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Tanya
Date Posted: 01 March 2006 at 7:40am
Yes


Posted By: Oleg
Date Posted: 03 March 2006 at 8:58am

I can't reproduce it with even "clear" Windows 2000 :(

May be something with msxml... not sure, Can you ask them to try to debug into px.LoadFromString and check what line failed.

:(



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Tanya
Date Posted: 07 March 2006 at 6:47am

Hi Oleg,

 

It was very agent bug. And I didn’t have a time to debug,

Because all these computers are always busy.

So I decided to remove all the “load from resource” issue.

 

All I need is to have 4 layouts (not in XML file that user can see and change).

And let user to switch between them.

So I created the layouts inside my program.

Like Run and Editor Mode in the Pane Sample.

 

And now I have a crash.

 

Scenario –

 

  • Run Pane Sample.
  • Make some pane float.
  • Change the Mode

 

Please try to help me as fast as possible.

 

Thanks,

Tanya



Posted By: Oleg
Date Posted: 07 March 2006 at 10:44am

I can't reproduce it also.

What version of Toolkit do you have?

Better open issue in issuetrack for faster response.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Tanya
Date Posted: 08 March 2006 at 4:52am

I have the last version - 9.81

Very strange that you can't reproduce.

1. Run Pane sample

2. DoubleClick on Pane 2 to make it Float

3. Go to Layout->Run Mode

Crash in the function -
void CXTPDockingPaneMiniWnd::OnSetFocus(CWnd* pOldWnd)

Line-
m_pTopContainer->FindPane(xtpPaneTypeTabbedContainer, &lst);

Here is a stack dump:

> ToolkitPro981vc71D.dll!CXTPDockingPaneMiniWnd::OnS etFocus(CWnd * pOldWnd=0x016ed9b0)  Line 381 + 0x1c C++
  mfc71d.dll!CWnd::OnWndMsg(unsigned int message=7, unsigned int wParam=2361370, long lParam=0, long * pResult=0x0012e2c8)  Line 2074 C++
  ToolkitPro981vc71D.dll!CXTPDockingPaneMiniWnd::O nWndMsg(unsigned int message=7, unsigned int wParam=2361370, long lParam=0, long * pResult=0x0012e2c8)  Line 850 C++
  mfc71d.dll!CWnd::WindowProc(unsigned int message=7, unsigned int wParam=2361370, long lParam=0)  Line 1745 + 0x1e C++
  mfc71d.dll!AfxCallWndProc(CWnd * pWnd=0x016c6890, HWND__ * hWnd=0x0009085e, unsigned int nMsg=7, unsigned int wParam=2361370, long lParam=0)  Line 241 + 0x1a C++
  mfc71d.dll!AfxWndProc(HWND__ * hWnd=0x0009085e, unsigned int nMsg=7, unsigned int wParam=2361370, long lParam=0)  Line 389 C++
  mfc71d.dll!AfxWndProcBase(HWND__ * hWnd=0x0009085e, unsigned int nMsg=7, unsigned int wParam=2361370, long lParam=0)  Line 209 + 0x15 C++
  user32.dll!77d48654()  
  user32.dll!77d48723()  
  user32.dll!77d49153()  
  user32.dll!77d49196()  
  ntdll.dll!77f75da3()  
  user32.dll!77d4d191()  
  mfc71d.dll!CWnd::DestroyWindow()  Line 988 + 0xd C++
  ToolkitPro981vc71D.dll!CXTPDockingPaneTabbedCont ainer::~CXTPDockingPaneTabbedContainer()  Line 177 C++
  ToolkitPro981vc71D.dll!CXTPDockingPaneTabbedCont ainer::`vector deleting destructor'()  + 0x6c C++
  ToolkitPro981vc71D.dll!CXTPDockingPaneLayout::Fr ee()  Line 83 + 0x32 C++
  ToolkitPro981vc71D.dll!CXTPDockingPaneLayout::Co py(const CXTPDockingPaneLayout * pLayout=0x016c8860)  Line 598 C++
  ToolkitPro981vc71D.dll!CXTPDockingPaneManager::S etLayout(const CXTPDockingPaneLayout * pLayout=0x016c8860)  Line 894 C++
  PaneD.exe!CMainFrame::SwitchLayout()  Line 476 + 0x1c C++
  PaneD.exe!CMainFrame::OnLayoutRun()  Line 494 C++
  mfc71d.dll!_AfxDispatchCmdMsg(CCmdTarget * pTarget=0x00332870, unsigned int nID=2788, int nCode=0, void (void)* pfn=0x0041164a, void * pExtra=0x00000000, unsigned int nSig=53, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000)  Line 89 C++
  mfc71d.dll!CCmdTarget::OnCmdMsg(unsigned int nID=2788, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000)  Line 396 + 0x27 C++
  mfc71d.dll!CFrameWnd::OnCmdMsg(unsigned int nID=2788, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000)  Line 897 + 0x18 C++
  mfc71d.dll!CMDIFrameWnd::OnCmdMsg(unsigned int nID=2788, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000)  Line 85 C++
  ToolkitPro981vc71D.dll!CXTPMDIFrameWnd::OnCmdMsg (unsigned int nID=2788, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000)  Line 306 C++
  mfc71d.dll!CWnd::OnCommand(unsigned int wParam=2788, long lParam=0)  Line 2550 C++
  mfc71d.dll!CFrameWnd::OnCommand(unsigned int wParam=2788, long lParam=0)  Line 320 C++
  mfc71d.dll!CMDIFrameWnd::OnCommand(unsigned int wParam=2788, long lParam=0)  Line 54 + 0x10 C++
  mfc71d.dll!CWnd::OnWndMsg(unsigned int message=273, unsigned int wParam=2788, long lParam=0, long * pResult=0x0012f0f0)  Line 1759 + 0x1c C++
  ToolkitPro981vc71D.dll!CXTPCommandBarsSiteBase&l t;CMDIFrameWnd>::OnWndMsg(unsigned int message=273, unsigned int wParam=2788, long lParam=0, long * pResult=0x0012f0f0)  Line 214 C++
  mfc71d.dll!CWnd::WindowProc(unsigned int message=273, unsigned int wParam=2788, long lParam=0)  Line 1745 + 0x1e C++
  mfc71d.dll!AfxCallWndProc(CWnd * pWnd=0x00332870, HWND__ * hWnd=0x000607de, unsigned int nMsg=273, unsigned int wParam=2788, long lParam=0)  Line 241 + 0x1a C++
  mfc71d.dll!AfxWndProc(HWND__ * hWnd=0x000607de, unsigned int nMsg=273, unsigned int wParam=2788, long lParam=0)  Line 389 C++
  mfc71d.dll!AfxWndProcBase(HWND__ * hWnd=0x000607de, unsigned int nMsg=273, unsigned int wParam=2788, long lParam=0)  Line 209 + 0x15 C++
  user32.dll!77d48654()  
  user32.dll!77d48723()  
  user32.dll!77d4a7eb()  
  user32.dll!77d4aa95()  
  ToolkitPro981vc71D.dll!CXTPHookManager::HookWndP roc(HWND__ * hWnd=0x000607de, unsigned int message=273, unsigned int wParam=2788, long lParam=0)  Line 169 + 0x1c C++
  user32.dll!77d48654()  
  user32.dll!77d48723()  
  user32.dll!77d4a0ec()  
  user32.dll!77d4aa77()  
  mfc71d.dll!CWnd::SendMessageA(unsigned int message=273, unsigned int wParam=2788, long lParam=0)  Line 44 + 0x42 C++
  ToolkitPro981vc71D.dll!CXTPControl::OnExecute()& nbsp; Line 339 C++
  ToolkitPro981vc71D.dll!CXTPControlButton::OnLBut tonUp(CPoint __formal={...})  Line 52 + 0x10 C++
  ToolkitPro981vc71D.dll!CXTPCommandBar::OnLButton Up(unsigned int nFlags=0, CPoint point={...})  Line 352 + 0x18 C++
  mfc71d.dll!CWnd::OnWndMsg(unsigned int message=514, unsigned int wParam=0, long lParam=2162750, long * pResult=0x0012fa54)  Line 2164 C++
  ToolkitPro981vc71D.dll!CXTPCommandBar::OnWndMsg( unsigned int message=514, unsigned int wParam=0, long lParam=2162750, long * pResult=0x0012fa54)  Line 1898 C++
  mfc71d.dll!CWnd::WindowProc(unsigned int message=514, unsigned int wParam=0, long lParam=2162750)  Line 1745 + 0x1e C++
  mfc71d.dll!AfxCallWndProc(CWnd * pWnd=0x016dc348, HWND__ * hWnd=0x00050996, unsigned int nMsg=514, unsigned int wParam=0, long lParam=2162750)  Line 241 + 0x1a C++
  mfc71d.dll!AfxWndProc(HWND__ * hWnd=0x00050996, unsigned int nMsg=514, unsigned int wParam=0, long lParam=2162750)  Line 389 C++
  mfc71d.dll!AfxWndProcBase(HWND__ * hWnd=0x00050996, unsigned int nMsg=514, unsigned int wParam=0, long lParam=2162750)  Line 209 + 0x15 C++
  user32.dll!77d48654()  
  user32.dll!77d48723()  
  user32.dll!77d4a7eb()  
  user32.dll!77d4aa95()  
  ToolkitPro981vc71D.dll!CXTPHookManager::HookWndP roc(HWND__ * hWnd=0x00050996, unsigned int message=514, unsigned int wParam=0, long lParam=2162750)  Line 169 + 0x1c C++
  user32.dll!77d48654()  
  user32.dll!77d48723()  
  user32.dll!77d48637()  
  user32.dll!77d48999()  
  mfc71d.dll!AfxInternalPreTranslateMessage(tagMSG * pMsg=0x00153c10)  Line 246 + 0x8 C++
  user32.dll!77d48fd2()  
  mfc71d.dll!AfxInternalPumpMessage()  Line 188 C++
  mfc71d.dll!CWinThread::PumpMessage()  Line 916 C++
  mfc71d.dll!CWinThread::Run()  Line 637 + 0xb C++
  mfc71d.dll!CWinApp::Run()  Line 701 C++
  mfc71d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f34, int nCmdShow=1)  Line 49 + 0xb C++
  PaneD.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00151f34, int nCmdShow=1)  Line 25 C++
  PaneD.exe!WinMainCRTStartup()  Line 390 + 0x39 C
  kernel32.dll!77e8141a()  

 



Posted By: Oleg
Date Posted: 08 March 2006 at 11:42am

yes, see it now :( 

Please replace two methods:

void CXTPDockingPaneLayout::Free()
{
 m_pTopContainer = 0;
 m_pClient = 0;

 while (!m_lstStack.IsEmpty())
 {
  CXTPDockingPaneBase* pPane = m_lstStack.RemoveTail();
  if (pPane->GetType() == xtpPaneTypeDockingPane)
  {
   ((CXTPDockingPane*)pPane)->InternalRele ase();
  }
  else
  {
   delete pPane;
  }
 }

 m_lstPanes.RemoveAll();

 memset(m_wndPanels, 0, sizeof(m_wndPanels));
}

and

void CXTPDockingPaneMiniWnd::OnSetFocus(CWnd* pOldWnd)
{
 CMiniFrameWnd::OnSetFocus(pOldWnd);

 if (m_pTopContainer == 0)
  return;

 if (!m_pLayout || !m_pLayout->IsValid())
  return;

 CXTPDockingPaneBaseList lst;
 m_pTopContainer->FindPane(xtpPaneTypeTabbedContaine r, &lst);

 if (lst.GetCount() == 1)
 {
  CXTPDockingPane* pPane =
   ((CXTPDockingPaneTabbedContainer*)lst.GetH ead())->GetSelected();
  if (pPane)
  {
   pPane->SetFocus();
  }
 }
}

 

Thank you.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: guywmustang
Date Posted: 09 May 2006 at 2:08pm
Has this error been fixed since version 9.81 because I have had the same crash.  I need to know if upgrading codejock will solve this problem, as it is a large bug for my software when trying to restore the layout.


Posted By: guywmustang
Date Posted: 09 May 2006 at 3:56pm

<bump>



Posted By: Oleg
Date Posted: 09 May 2006 at 4:37pm

Hi,

Yes, in 10.1.1 it was fixed.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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