![]() |
How to add icons to right click view context menu |
Post Reply
|
| Author | |
mojoturner
Newbie
Joined: 02 May 2011 Location: United States Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Topic: How to add icons to right click view context menuPosted: 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
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
mojoturner
Newbie
Joined: 02 May 2011 Location: United States Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 May 2011 at 4:55pm |
|
Wow, so simple. Exactly what I was after.
Thanks Oleg! Craig
|
|
![]() |
|
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 |