On the right-click menu problem

Category: VC/MFC -> UI Author: z19871025y Date: 2012-02-17 23:29:24
 
z19871025y
2012-02-17 23:29:24
I use CEdit :: Create a dialog box generated on several CEdit part , would like to add these components CEdit context menu , how should I do ?
asozh
2012-02-17 23:56:50
join the project header file
# include & nbsp in myedit.cpp in ; " test6.h "

void   CMyEdit :: OnRButtonDown (UINT   nFlags,   CPoint   point)  
{
//   TODO:   Add   your   message   handler   code   here   and / or   call   default
CMenu   menu;
ClientToScreen (& point);
VERIFY (  menu.LoadMenu (  IDR_MENU1  )  );
CMenu *   popup   =   menu.GetSubMenu (0 );
ASSERT (  popup   =   NULL  );
popup- > EnableMenuItem (ID_POPUP1,  ! MF_BYCOMMAND | MF_GRAYED);
popup- > ModifyMenu (ID_POPUP1 , MF_BYCOMMAND, ID_POPUP1,   " 11 ");
popup- > TrackPopupMenu (TPM_LEFTALIGN   |   TPM_RIGHTBUTTON,   point.x,   point.y,   this  );    
popup- > CheckMenuItem (ID_POPUP1,   MF_BYCOMMAND);

CEdit :: OnRButtonDown (nFlags,   point);
}
tbestlm01
2012-02-18 00:12:26
overloaded class CEdit, add menu OnRButtuonDown in .
xylon_z
2012-02-18 00:29:22
pick slbing0725 ( monthly rain )  :

inherit a CMyEdit
then reload OnRButtonDown from CEdit, add dynamically generated menu

when using CMyEdit :: Create
lys0928
2012-02-18 00:57:15
TU ? Can elaborate? CEdit controls are dynamically generated .