Question: CContextMenu

Need help running MacroQuest2? Ask your questions about how to get things to work on your computer.

Moderator: MacroQuest Developers

Tamian
a lesser mummy
a lesser mummy
Posts: 54
Joined: Wed Nov 12, 2003 2:41 pm

Question: CContextMenu

Post by Tamian » 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:

Code: Select all

AddXMLFile("MQUI_MyWnd.XML");
class CMyWnd:: public CCustomWnd
{
    // MyWnd stuff

}

CMyWnd *MyWnd;
MyWnd = new CMyWnd;
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:

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);
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.
Last edited by Tamian on Fri Jun 04, 2004 1:33 pm, edited 1 time in total.

Tamian
a lesser mummy
a lesser mummy
Posts: 54
Joined: Wed Nov 12, 2003 2:41 pm

Post by Tamian » Fri Jun 04, 2004 1:23 pm

Just to give more of an idea of what I am trying to do.

Off each of those, on an right click I want to create a context menu (undefined as I have 2 modes .. users and mangagers .. and want to be able to dynamically create the contents of those menus).

Image

Image

Image