![]() |
Save to XML ? |
Post Reply ![]() |
Author | |
kanitamildasan ![]() Senior Member ![]() ![]() Joined: 01 February 2006 Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() Posted: 19 May 2009 at 1:06am |
Hi,
How to save the .RC file to XML file that we can load using CommandBars LoadDesignerBars() ? Thanks |
|
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2 Visual C++ 6.0 SP 6 |
|
![]() |
|
kanitamildasan ![]() Senior Member ![]() ![]() Joined: 01 February 2006 Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() |
Hi,
I have tried to use the menu grabber from the Commandbars Designer to capture the menu of our application(app uses the XT Menubar) the grabber didnt grabbed the menu ? ![]() Thanks |
|
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2 Visual C++ 6.0 SP 6 |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Yes, grabber can grab only standard menus. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
kanitamildasan ![]() Senior Member ![]() ![]() Joined: 01 February 2006 Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() |
Thanks Oleg, Is there anyother way to save .RC to XML which can be loaded using LoadDesignerBars()?
|
|
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2 Visual C++ 6.0 SP 6 |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
You can create menu first from .RC and then GetCommandBars()->DoPropExchange to save to XML.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
kanitamildasan ![]() Senior Member ![]() ![]() Joined: 01 February 2006 Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() |
Thanks Oleg,
1) The XML file have different tags when we save using CommandBars Designer and DoPropExchange. 2) I have saved an XML using DoPropExchange and tried to open in CmdDesigner but i got errors about the missing tags.I fixed it by changing "Settings" to "DesignerFile" than the error didnt come but cmdbars designer remains empty. 3) And i tried to load the DoPropExchange's XML using LoadDesignerBars() in the Designer Sample but i didnt get any menu or toolbar in the application. |
|
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2 Visual C++ 6.0 SP 6 |
|
![]() |
|
kanitamildasan ![]() Senior Member ![]() ![]() Joined: 01 February 2006 Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() |
Hi, How to write XML file using DoPropExchange which can read by CommandBars Designer or LoadDesignerBars() ?
|
|
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2 Visual C++ 6.0 SP 6 |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi, please open new ticket in issuetrack - show all code you call to save CommandBars.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
kanitamildasan ![]() Senior Member ![]() ![]() Joined: 01 February 2006 Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() |
Hi Oleg, I have used the Support form to post the question.
|
|
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2 Visual C++ 6.0 SP 6 |
|
![]() |
|
kanitamildasan ![]() Senior Member ![]() ![]() Joined: 01 February 2006 Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() |
Oleg, I have posted the question (which is the same question I posted here in the forum on 19-May-2009) in the IssueTrack but unfortunately our subscribtion for XT Pro expired on 26-May-2009 so the Customer Service cant able assign the issue for assistance.
|
|
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2 Visual C++ 6.0 SP 6 |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Set all params to true when you save it
XTP_COMMANDBARS_PROPEXCHANGE_PARAM param;
param.bSerializeControls = TRUE; param.bSerializeDesignerControls = TRUE; param.bSerializeImages = TRUE; param.bSerializeOptions = TRUE; param.bSerializeActions = TRUE; GetCommandBars()->DoPropExchange(&px, ¶m);
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
kanitamildasan ![]() Senior Member ![]() ![]() Joined: 01 February 2006 Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() |
uploads/20090528_090733_Resources.zip
Hearty ![]() I have created a default sample using the VC++ 6 wizard provided by CodeJock. And pasted the code you provided in void CMainFrame::OnClose() { // Save the current state for toolbars and menus. SaveCommandBars(_T("CommandBars")); CString m_strXmlFileName = "Resources.xml"; CXTPPropExchangeXMLNode pPX(FALSE, 0, _T("DesignerFile")); // To serialize to XML file XTP_COMMANDBARS_PROPEXCHANGE_PARAM param; param.bSerializeControls = TRUE; param.bSerializeDesignerControls = TRUE; param.bSerializeImages = TRUE; param.bSerializeOptions = TRUE; param.bSerializeActions = TRUE; GetCommandBars()->DoPropExchange(&pPX, ¶m); pPX.SaveToFile(m_strXmlFileName); CMDIFrameWnd::OnClose(); } I have the AfxOleInit() in InitInstance. But the XML file saved by this sample app didnt have CommandBars node in the XML file. (I have attached the file.) Thanks |
|
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2 Visual C++ 6.0 SP 6 |
|
![]() |
|
kanitamildasan ![]() Senior Member ![]() ![]() Joined: 01 February 2006 Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() |
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2 Visual C++ 6.0 SP 6 |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
right, you also need
param.bSaveOnlyCustomized = FALSE;
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
kanitamildasan ![]() Senior Member ![]() ![]() Joined: 01 February 2006 Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() |
Thanks Oleg,
Now i can able to load the CommandBars from the XML using LoadDesignerBars() but the handler for ON_XTP_CREATECONTROL() didnt called by XT ? |
|
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2 Visual C++ 6.0 SP 6 |
|
![]() |
|
kanitamildasan ![]() Senior Member ![]() ![]() Joined: 01 February 2006 Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() |
Hi, How to create CustomControls without using OnCreateControl() ?
|
|
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2 Visual C++ 6.0 SP 6 |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
create with new CXTPControlCustom() and insert with pToolbar->GetControls()->Add(pControl);
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
kanitamildasan ![]() Senior Member ![]() ![]() Joined: 01 February 2006 Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() |
Thanks Oleg,
Do i need to add pToolbar->GetControls()->Add(pControl); in Mainframe::OnCreate() ? LoadFrame() ? Add() will add the control at the end of toolbar controls but OnCreateControl() really provides an easy way to Put Customcontrols in the Toolbar in their own location. My old code that uses the loading of commandbars from resource works when i create custom controls in OnCreateControl() but when i Load Commandbars using the LoadDesignerBars() using XML file it didnt work the same way so i dont know which event will be called by LoadDesignerBars() where i can create custom controls which provides similar function of OnCreateControl() rather than using Add() method ... 2) oncreatecontrol() ? 2) createcommandbar() ? 3) oninitcommandspopup() ? 4) other ? Thanks again |
|
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2 Visual C++ 6.0 SP 6 |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Just call it after you already load designer bars.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
kanitamildasan ![]() Senior Member ![]() ![]() Joined: 01 February 2006 Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() |
Thanks Oleg, I will check out ...
|
|
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2 Visual C++ 6.0 SP 6 |
|
![]() |
|
kanitamildasan ![]() Senior Member ![]() ![]() Joined: 01 February 2006 Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() |
Hi Oleg,
I have added a CommandButtonPopup(ColorPopup) using the pToolbar->GetControls()->Add() method after LoadDesignerBars(), the new button appears on the toolbar but still the OnCreateControl() is not called ? |
|
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2 Visual C++ 6.0 SP 6 |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Yes, OnCreateControl is called only when you add buttons using IDs (pToolBar->SetButtons or pToolBar->LoadToolBar). If you manually create it, its not called.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
kanitamildasan ![]() Senior Member ![]() ![]() Joined: 01 February 2006 Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() |
Thanks Oleg,
I am creating a ColorPopup in the OnCreateControl() like if (lpCreateControl->nID == ID_COLOR) { CXTPControlPopupColor* pPopupColor = new CXTPControlPopupColor(); CXTPPopupBar* pColorBar = CXTPPopupToolBar::CreatePopupToolBar(GetCommandBars()); pPopupColor->SetCommandBar(pColorBar); pColorBar->GetControls()->Add(new CXTPControlButtonColor(), XTP_IDS_AUTOMATIC_FILL); pColorBar->GetControls()->Add(new CXTPControlColorSelector(), ID_SELECTOR_FILL); pColorBar->GetControls()->Add(new CXTPControlButtonColor(), XTP_IDS_MORE_COLORS_FILL); pColorBar->SetTearOffPopup(_T("Color"), 1006, 0); pColorBar->InternalRelease(); lpCreateControl->pControl = pPopupColor; return TRUE; } and a custom control like if (lpCreateControl->nID == ID_STYLE) { CXTPControlCustom* pControl = CXTPControlCustom::CreateControlCustom(&m_wndComboStyle); pControl->SetFlags(xtpFlagManualUpdate) ; lpCreateControl->pControl = pControl; return TRUE; } If we use XML which is the best way to do the same ? |
|
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2 Visual C++ 6.0 SP 6 |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
So just use same code - first create control and then add it with pToolBar->GetControls()->Add(pPopupColor );
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
kanitamildasan ![]() Senior Member ![]() ![]() Joined: 01 February 2006 Status: Offline Points: 102 |
![]() ![]() ![]() ![]() ![]() |
Hearty Thanks Oleg for your support and spending your valuable time for me.
![]() |
|
Xtreme ToolkitPro 12.1.1
Win XP (32bit) - SP2 Visual C++ 6.0 SP 6 |
|
![]() |
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 |