Print Page | Close Window

How to implement shortcut menus

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=11799
Printed Date: 07 October 2024 at 2:21pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to implement shortcut menus
Posted By: Number8
Subject: How to implement shortcut menus
Date Posted: 12 August 2008 at 1:57pm
Hello,

Our application has several different kinds of child windows -- a graph, a spreadsheet, a text editor, etc.
Can we use some kind of CommandBar to implement a shortcut menu for each window?  How do we activate the menu (presumably from the WM_RBUTTONDOWN handler for the window)?

Thanks for any advice or pointers to articles/samples/tutorials...




Replies:
Posted By: Oleg
Date Posted: 13 August 2008 at 1:20am
Hello,
 
Most our samples show context menus. Please check them.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: MadRiver
Date Posted: 21 August 2008 at 1:45pm
It looks like all the samples create the popup menu/commandbar at the time it is needed.

Two questions:
-- What happens when this is done multiple times?  Are duplicate items ignored?

-- I would like to create my context menus at startup, then display them in the specific event handler.  It's not clear how to find/retrieve the correct commandbar/popup object.
For example, if I do something like this:
    ICommandBarPtr  pPopup = 0;
    pPopup = g_spCommandBars->Add("MapperPopup", xtpBarPopup);
    pControls = pPopup->GetControls();
    // add controls...

If all that happens in the event handler for the right mouse click, this
    pPopup->ShowPopup();
works as expected.

Thanks for any pointers...


Posted By: Oleg
Date Posted: 22 August 2008 at 1:02am
Hello,
 
Add("MapperPopup", xtpBarPopup) don't really add it to commandBars collection but just create it and return pointer. so it will be destroyed when your pPopup  will be destroyed.
 
Better add it to ContextMenus collection.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net