Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - ContextMenu
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ContextMenu

 Post Reply Post Reply
Author
Message
Pixbyte View Drop Down
Groupie
Groupie


Joined: 11 April 2007
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pixbyte Quote  Post ReplyReply Direct Link To This Post Topic: ContextMenu
    Posted: 06 February 2011 at 8:01am
Hello,

how to make context menu the same style as commandbars? Is it possible to "clone" a commandbar Menu to a context menu?

Ocrana
Back to Top
Pixbyte View Drop Down
Groupie
Groupie


Joined: 11 April 2007
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pixbyte Quote  Post ReplyReply Direct Link To This Post Posted: 07 February 2011 at 3:43am
Ok, I found it out. For all who are looking for the same:

CMenu menu;
menu.LoadMenu(IDR_MENQUEUE);
CMenu* pPopup = menu.GetSubMenu(0);

CXTPCommandBars* pCommandBars = GetCommandBars();
UINT nCmd = static_cast<UINT>(CXTPCommandBars::TrackPopupMenu(pPopup,TPM_RIGHTBUTTON | TPM_LEFTALIGN, dwStyle == xtpButtonDropDownRight ? rect.right : rect.left, dwStyle == xtpButtonDropDownRight ? rect.top : rect.bottom, this, NULL, 0, pCommandBars));

Cause it is a CommandBar, the Flag: TPM_RETURNCMD will not work. You have to use the common "OnCommand" function like with the other Menu. If the Image Manager contain a image for the submenu IDs, you will have icons in the submenu, too.

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.203 seconds.