![]() |
Adding Menu Item at RUN Time |
Post Reply
|
| Author | |
KumarCJ
Groupie
Joined: 02 April 2007 Location: India Status: Offline Points: 96 |
Post Options
Thanks(0)
Quote Reply
Topic: Adding Menu Item at RUN TimePosted: 14 August 2007 at 8:33am |
|
Hello,
How to add the menu item (say : Sync) in main menu at Run Time.
I wanted to add menu item (say : Sync) in TOOLs menu at Run time. Priviously we used "InsertMenu()".
How can I do?
Thanks,
KumarCJ.
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 14 August 2007 at 10:15am |
|
Hello,
to add item to menu:
pMenuBar->GetControls()->Add(xtpControlButton, ID);
See \Samples\CommandBars\DynamicPopups sample.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
KumarCJ
Groupie
Joined: 02 April 2007 Location: India Status: Offline Points: 96 |
Post Options
Thanks(0)
Quote Reply
Posted: 15 August 2007 at 6:24am |
|
I Tried using the code you suggested CXTPCommandBar* pMenuBar;
pMenuBar->GetControls()->Add(xtpControlButton, ID);
"Sync" menu item is not added in "TOOLs" main menu.
It is added after the "HELP" main menu.
Once again I am putting the requirement below:
Under TOOLs main menu, we have "Trace", "Option", "Customize" menu items.
At run time based on some condition I wanted to add the "Sync" menu item under "TOOLs" Main menu after "Trace" and before "Option" menu item and delete "Sync" from "TOOLs" main menu for some condition.
I checked the \Samples\CommandBars\DynamicPopups sample, but I did not found
"pMenuBar->GetControls()->Add(xtpControlButton, ID);".
Waiting for your suggestion.
Thanks,
KumarCJ
|
|
![]() |
|
terrym
Senior Member
Joined: 13 April 2007 Status: Offline Points: 836 |
Post Options
Thanks(0)
Quote Reply
Posted: 15 August 2007 at 6:33am |
|
Use:
pMenuBar->GetControls()->InsertAt(xtpControlButton, nIndex);
where nIndex is the item you want to place before
|
|
|
Thank you,
Terry Mancey email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 15 August 2007 at 12:53pm |
|
KumarCJ,
pMenuBar->GetControls()->InsertAt, pMenuBar->GetControls()->Add add item to menu.
if you need to add to submenu, you need add control to corresponded commandbar:
pMenuBar->GetControl(nIndexOfToolsPopup)->GetCommandBar()->GetControls()->Add(...);
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
KumarCJ
Groupie
Joined: 02 April 2007 Location: India Status: Offline Points: 96 |
Post Options
Thanks(0)
Quote Reply
Posted: 16 August 2007 at 4:22am |
|
Thanks alot Oleg....
|
|
![]() |
|
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 |