Question: CContextMenu
Posted: Fri Jun 04, 2004 12:52 pm
Trying to understand using context menus. I have been looking over the default XML files and no examples that I could find use a context menu embeded within the XML.
So the question is ....
Assume:
So now I have my window ... and want to a context menu NOT defined in the XML. In looking over the class definitions I found:
CContextMenu::CContextMenu(class CXWnd *,unsigned __int32,class CXRect)
I am assuming thit takes a pointer to MyWnd, the default color, and the size of the context window.
So to continue the code:
The question is, can I create the context menu that way, are those parameters correct, and what is the 3rd parameter of AddMenuItem. And is there a need to worry about CContextMenuManager? And where would the window notifications go ... as gets attached to MyWnd I am assuming there.
So the question is ....
Assume:
Code: Select all
AddXMLFile("MQUI_MyWnd.XML");
class CMyWnd:: public CCustomWnd
{
// MyWnd stuff
}
CMyWnd *MyWnd;
MyWnd = new CMyWnd;
CContextMenu::CContextMenu(class CXWnd *,unsigned __int32,class CXRect)
I am assuming thit takes a pointer to MyWnd, the default color, and the size of the context window.
So to continue the code:
Code: Select all
int iTop=10;
int iBottom=30;
int iLeft=10;
int iRight=50;
CContextMenu *MyContextMenu;
CXRect MyCXRect(iTop,IBottom,iLeft,iRight);
MyContextMenu = new CContextMenu((CXWnd *)MyWnd ,ConColorToARGB(CONCOLOR_BLACK),MyCXRect);
UINT uiMenuLinePositionToAdd = 0;
bool bIsChecked = false;
long lIHaveNoClue = 0;
MyContextMenu->AddMenuItem("A_menuline_01",uiMenuLinePositionToAdd,bIsChecked,lIHaveNoClue);


