![]() |
Saving .xcb file |
Post Reply ![]() |
Author | |
Kenneth ![]() Senior Member ![]() ![]() Joined: 23 May 2004 Location: United States Status: Offline Points: 256 |
![]() ![]() ![]() ![]() ![]() Posted: 23 August 2004 at 12:58pm |
What is the correct methd to create an .xcb file from an application that has created the Commandbars internally. We need to take a current application, create a .xcb file, then allow our users to use the CommandBarsDesigner program to create their custom CommandBars.
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
You can see it in void CEmbeddedFrame::Serialize(CArchive& ar) of Samples\Common\CommandBarsDesigner\EmbeddedFrame.cpp |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Kenneth ![]() Senior Member ![]() ![]() Joined: 23 May 2004 Location: United States Status: Offline Points: 256 |
![]() ![]() ![]() ![]() ![]() |
Yes, I looked at that, but in order to understand that requires a lot of knowledge about the internals of the toolkit. Like, where in a normal application does the variable m_pControls get set? That appears to be a critical element of the Serialize function. Does this imply that the embeddedframe class must be incorporated into a user application in order to create a .xcb file for the controls created in that application?
Edited by Kenneth |
|
![]() |
|
Kenneth ![]() Senior Member ![]() ![]() Joined: 23 May 2004 Location: United States Status: Offline Points: 256 |
![]() ![]() ![]() ![]() ![]() |
I can add the following code to my application, which does create a valid xcb file, which I can read back into my application. However, the CommandBarsDesigner sample application cannot load the file (it aborts looking for command bar id 0XFFEEFF. Also, I have an Animation control bar that does get created when I load the xcb file into the application, however the animation itself is never loaded. I checked the function: int CMainFrame::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl) which does get called, but the nID for the animation is not passed to this function. So I guess the question is, what is the crazy stuff related to command bar id 0x(FFEEFF) when it comes to the CommandBarsDesigner application? And why, when loading from a xcb file, the animation nID is not getting passed to the OnCreateControl function? The following is my code to create the xcb file. void CMainFrame::DoSerializeCommandBars(CArchive& ar)
|
|
![]() |
|
Kenneth ![]() Senior Member ![]() ![]() Joined: 23 May 2004 Location: United States Status: Offline Points: 256 |
![]() ![]() ![]() ![]() ![]() |
Ah, I see the problem now. Although my program can correctly load the .xcb it created, the CommandBarDesigner cannot since my application uses classes such as CControlTools. This causes the CommandBarDesigner to abend in the LoadCommandBarList() function. So I guess CommandBarDesigner will not work with any menu and or toolbar that uses CControlTools or anything esle other than a plain old menu or toolbar item. Good concept, but rather useless.
|
|
![]() |
|
Kenneth ![]() Senior Member ![]() ![]() Joined: 23 May 2004 Location: United States Status: Offline Points: 256 |
![]() ![]() ![]() ![]() ![]() |
It would appear the the problem referenced above is not due to any problem in the CommandBarDesigner example application. When I trace the calls made, functions with the toolkitpro api is expecting the custom controls to be serialized within the .xcb file. However I see no facility to be able to accomplich this in the creation of the .xcb file itself. The end result is the toolkitpro api attempts to locatate the serialized controls within the .xcb file, thus messing up the pointers used to read the file, and results in an message "unexpected format". A second problem happens when loading an .xcb file into an application, within the mainfrm OnCreate function, it appears that when the following functions are called: CXTPPropExchangeSection secShortcuts(pPX->GetSection(_T("Shortcuts"))); will cause MFC to ASSERT in LoadAccelerators. Note that since the mainfrm function LoadFrame calls: if(!CFrameWnd::LoadFrame(nIDResource,dwDefaultStyle,pP arentWnd,pContext)) then the the accelerator table pointer is not NULL, thus the ASSERT. The .xcb file is loaded correctly, and all the command bars are created correctly, you just get the ASSERT. I suspect the accelerator pointer should be freeded, and set to NULL prior to the XTPShortcutManager()->DoPropExchange(&secShortcuts,th is); call resetting the accelerator pointer. Edited by Kenneth |
|
![]() |
|
jayee ![]() Newbie ![]() Joined: 14 September 2005 Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() |
Hello!
I have a similar problem with the ASSERT in CFrameWnd::LoadAccelTable. All I have done is exported a xml file in Command Bars Designer and this file is then loaded in the OnCreate call of my main frame. CXTPPropExchangeXMLNode px(TRUE, 0, _T("DesignerFile")); if (px.LoadFromFile(COMMAND_BARS_FILE)) { pCommandBars->LoadDesignerBars(&px); } else { TRACE0("Failed to load command bars from file.\n"); return -1; } return 0; I'm using Xtreme Suite Pro v9.70 How can I circumvent this assert? Is the loading of the command bars too early? Thanks |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Try to move this code to LoadFrame as it done in DesignerSample. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
jayee ![]() Newbie ![]() Joined: 14 September 2005 Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() |
Thanks it worked great!
I should have discovered DesignerSample yesterday... |
|
![]() |
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 |