Originally posted by: Javier
Helleo I create a popup menu in an MFC activeX control but I can't disable an item? Why it dose't work?
:
int CAGDCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
// carga el menu
m_pmenu = new CMenu();
m_pmenu->CreatePopupMenu();
m_pmenu->AppendMenu(MF_STRING | MF_DISABLED, IDM_VEREV, (LPCTSTR)"&Ver Evento...");
m_pmenu->AppendMenu(MF_STRING | MF_GRAYED, IDM_MODIFEV, (LPCTSTR)"&Editar Evento...");
m_pmenu->AppendMenu(MF_STRING | MF_GRAYED, IDM_BORRAREV, (LPCTSTR)"&Borrar Evento...");
m_pmenu->AppendMenu(MF_SEPARATOR, 0, "");
m_pmenu->AppendMenu(MF_STRING | MF_GRAYED, IDM_INFO, (LPCTSTR)"&Info...");
return 0;
}
this method don't work, and this donens't work
(este otro metodo tampoco funciona:
m_menu.EnableMenuItem(IDM_MODIFEV, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
why?
ReplyOriginally posted by: kws
Hi,
Anyone know how can I capture the event when user select on an item on the menu list?
I need to do some other operation after the user has made selection. Each different selection will run different operation.
Thanks lot for the time and input from all you guys
KwS
ReplyOriginally posted by: Leaves
Thank You ~~
ReplyOriginally posted by: M'ster
Dude.... you are sooooo the man !! what would have taken me few hours I got done in 3 1/2 mins !!! You go !!!
Reply
Originally posted by: Nemesyzz
Great - Thank You Very Much!!!
Reply
Originally posted by: Govind
I used your code to show popup menu on right click on a list control. The handlers for the menu commands were not at all called.
Then I tried with TPM_RETURNCMD value commented in TrackPopupMenu() function and it worked from then.
I dont know how this fixed though.
Originally posted by: shanthu
Most powerful things are often Simple.
This made some of my work lot simpler.
Reply
Originally posted by: hankaaron
The one part of the microsoft's example that they leave out is how to get the current cursor position. When you use the list control window for a pop-up menu, the message handler does not give you the mouse co-ordinates(very odd that the C++ team decided to do this). I had forgotton about the GetCurPos function- that solved the problem. Again Thanks!
ReplyOriginally posted by: Giyoar Sharaby
I used the conventional menu which contained a very large list of items. For some reasone the menu sent me the wrong item command - only on the items last items on the list. It looks like it mis-calculated the items height and sent the above item command.
This method fix the problem.
Thanks again.
Giyora, Israel
Originally posted by: diya
Could you please help?
I am trying to display a menu using the code below:
CMenu menu;
POINT pp;
DWORD selection;
VERIFY(menu.LoadMenu(IDR_MENU1));
// HWND m_hwnd = pNMHDR->hwndFrom;
// CWnd* myWnd = FromHandle(m_hwnd);
GetCursorPos(&pp);
selection = menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, pp.x+2,pp.y+2, this);
menu.DestroyMenu();
The menu is effectively displayed but only a narrow section, the rest is not visible. What could be the problem?
Thank you. Hope to hear from you soon!
Diya