![]() |
Dynamically Adding Menu Items |
Post Reply
|
| Author | |
cdrew
Newbie
Joined: 03 September 2004 Status: Offline Points: 1 |
Post Options
Thanks(0)
Quote Reply
Topic: Dynamically Adding Menu ItemsPosted: 03 September 2004 at 6:28pm |
|
I am a new user to the Pro version of toolkit and am trying to get to grips with the menus and toolbars which are very different from their MFC equivalents. As such I am updating my application to work as it did before under the toolkit. I want to add a list of MRU reports to a Reports menu. I have added a handler for OnInitCommandsPopup, ensured that the popup menu is in fact the Reports menu and then wondered how to add items to it. My thoughts were to create a CMenu popup menu and then add my new items to it, finally calling LoadMenu to load the CMenu into the command bar. This should have loaded a menu with 10 items but instead I only got the one and this was disabled. I have used the following code: // get the list of commands for the popup. // Is this the ReportWizard menu? // OK - we are popping up the Reports Menu - let's build the menu first DWORD dwCmdID = ID_FILE_MRU_FILE1; // ...add ReportWizard to the end of the menu // ...and then load this menu This should have created loads of entries but instead I get 1 entry in the menu from the array of reports and the final ReportWizard entry - however the menu items entered in the loop are all disabled. I have also added ON_COMMAND_RANGE(ID_FILE_MRU_FILE1, ID_FILE_MRU_FILE16, OnMRUReport) to my message map so it should (and did under MFC) work. Any suggestions would be very welcome |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 05 September 2004 at 3:31am |
|
use CXTPCommandBars::Add method to add dynamic items: pReports->Add(xtpControlButton, dwCmdID);
or try to review DynamicPopups sample. |
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
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 |