Print Page | Close Window

How to add icons to right click view context menu

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=18326
Printed Date: 11 September 2025 at 11:43pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to add icons to right click view context menu
Posted By: mojoturner
Subject: How to add icons to right click view context menu
Date Posted: 05 May 2011 at 6:45pm
I've successfully started implementation of a ribbon toolbar and that's all going fine given the greate sample app examples.  However, here's what I want to do and I can't figure it out:
 
If I right-click in an active view, I have a right-click view pop-up context menu.  This has been working fine for years.  For example here's my right-click context menu as it appears now:
 
 
However, I'd like this to be styled congruently with my ribbon interface.  I'm using the xtpThemeOffice2007 style.  I'd like to see icons on the left side of my context menu vs. the current check-boxes.  How do I accomplish this?
 
Here's my existing code for creating my right-click context menu.  Feel free to edit to help me out:
 
CMenu parent_menu;
CMenu * popup_menu;
CRect rect;
CPoint new_menu_position;
UINT popup_menu_id = IDR_VIEW_POPUP;
parent_menu.LoadMenu (popup_menu_id);
// Get a pointer to the menu
popup_menu = parent_menu.GetSubMenu (0);
PopulateViewPopup1( popup_menu, class_type);
// Display the menu at the mouse click position
GetWindowRect(&rect);
// Transform the screen coordinate point to a window-relative point
new_menu_position = CPoint (rect.left + point.x, rect.top + point.y);
 
Thanks for the help!
Craig



Replies:
Posted By: Oleg
Date Posted: 06 May 2011 at 1:46am
Check how RibbonSample implement such context menu.

Instead API TrackPopupMenu, try 

((CXTPMDIFrameWnd*)AfxGetMainWnd())->GetCommandBars()->
TrackPopupMenuEx(popup_menu, TPM_RIGHTBUTTON, point.x, point.y);



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


Posted By: mojoturner
Date Posted: 06 May 2011 at 4:55pm
Wow, so simple.  Exactly what I was after.
 
Thanks Oleg!
 
Craig



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