Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Reload Menus from Resource
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Reload Menus from Resource

 Post Reply Post Reply
Author
Message
msherman View Drop Down
Newbie
Newbie


Joined: 11 February 2005
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote msherman Quote  Post ReplyReply Direct Link To This Post Topic: Reload Menus from Resource
    Posted: 11 February 2005 at 11:20am

Hello,

Using CXTPCommandBars I call SetMenu and pass in the resource ID. It works wonderfully well, the menus are created. However I would like to provide the ability for users to refresh their menus, after they have configured them, to their original state as they are defined in the resource file. Is there a way to do this?

Thanks

Mark

Back to Top
SuperMario View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 11 February 2005 at 11:37am
Yes there is.  By default all toolbar have a "Reset" button to reset to there original configuration.  I think you need to enable customization (There is a post on here somewhere that tells how).


Back to Top
msherman View Drop Down
Newbie
Newbie


Joined: 11 February 2005
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote msherman Quote  Post ReplyReply Direct Link To This Post Posted: 11 February 2005 at 11:49am

Thanks for the very fast reply! Is there a way to launch a refresh programmatically and not just when the user selects the refresh menu item? Also it appears that the reset feature you mention calls CXTPToolBar::Reset(). I would like to run the same type of functionality on a CXTPMenuBar but however the overridden method Reset() is private in that class.

Thanks

Mark

Back to Top
SuperMario View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 11 February 2005 at 12:07pm
Hmm, in the next release you can save you layout to an XML file.  You could then save a "default" layout of your menus as you want them.  Then you would simply load the "default" menu.  All can be done programmatically.  New release should be out next week.  Currently you can load and save with XCB files, but you have to create the menuin the Designer Studio.  So unless someone else has a better solution I would suggest waiting until the next release for the XML file functionality.

Edited by SuperMario
Back to Top
msherman View Drop Down
Newbie
Newbie


Joined: 11 February 2005
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote msherman Quote  Post ReplyReply Direct Link To This Post Posted: 11 February 2005 at 12:52pm

On a potentially tangential topic, what does CXTPMenuBar::LoadMenuBar() do? I called it passing in the resource id for the menu I would like to refresh and it seems to have successfully reset the menu to its state as defined in the resource file. However I also got an assert in xtpmenubar.cpp line 508.

Thanks

Mark

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 11 February 2005 at 1:27pm

Use

CMenu menu;
menu.LoadMenu(nIDResource);
pMenuBar->LoadMenu(&menu);

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
msherman View Drop Down
Newbie
Newbie


Joined: 11 February 2005
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote msherman Quote  Post ReplyReply Direct Link To This Post Posted: 11 February 2005 at 2:43pm

Thank You! It works perfectly.

Mark

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.031 seconds.