I want to be able to create a Popup menu on a right mouse click event. Since I have several forms I really don`t want several popup menu obejcts, and the associated componenets. Therefore, I want to just create one when the user right mouse clicks on the form, etc... and then destroy it when done to free up the memory. I assume that this is possible; however, I have been unable to find an example. Any help would be greatly appreciated.
Thanks.
C. Lamb
This is typically done; I`m surprised your examples don`t show it.
static void menu_raise_callback_proc(blah,blah,blah)
{
static Widget popup_menu = (Widget)NULL;
if (NULL == popup_menu)
{
/* create it here e.g. XmCreatePopupMenu() */
}
/* more stuff here */
XmMenuPosition();
XtManagechild(popup_menu);
}
I have been able to create the Popup menus by passing a parent to the function that creates the menu (XmcreatePopupMenu ... ?). The problem is in that since I have layored forms I was having to create multiple Popup menus to make sure that my top forms provided access to the popupmenu. This ended up creating 38 popup menu instances. 1 for every top form that needed to provide the menu access.
I would like to only create one popup menu instance. I was wanting to capture the right mouse click event for the parent, for example the form, and then create the menu then. Once I am done with menu destroy it to free up the memory.
Is this a standard Motif procedure that I can use to capture the right mouse event?
static void menu_raise_callback_proc(blah,blah,blah)