Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How to add icons to right click view context menu
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to add icons to right click view context menu

 Post Reply Post Reply
Author
Message
mojoturner View Drop Down
Newbie
Newbie
Avatar

Joined: 02 May 2011
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote mojoturner Quote  Post ReplyReply Direct Link To This Post Topic: How to add icons to right click view context menu
    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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 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
Back to Top
mojoturner View Drop Down
Newbie
Newbie
Avatar

Joined: 02 May 2011
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote mojoturner Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 2011 at 4:55pm
Wow, so simple.  Exactly what I was after.
 
Thanks Oleg!
 
Craig
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.047 seconds.