[comp.windows.ms.programmer] Why I couldn't popup different menus by three buttons???

qzhang@uhunix1.uhcc.Hawaii.Edu (Qing Zhang) (06/26/91)

Newsgroups: window
Subject: WHY  ONLY POPUP ONE menu with three buttons in MOTIF???
Summary: 
Followup-To: 
Distribution: 
Organization: University of Hawaii at Manoa
Keywords: 

Hello,

I am working a graphic editor. I have been trying to use three buttons by
DEPRESSING ONE OF THEM to popup different popup editing menu within the 
drawingarea. But I only can get one popuped, no second one showed.

What I did is sketched as follows (using the XtAddEventHandler() similar 
approaches like action table can be the same.).
 
main(){
   ...
   create_popupmenu1(drawingarea);
   create_popupmenu2(...);
   create_popupmenu3(...);
   ...
}

create_popupmenu1(){
   popup1 = XmCreatePopupMenu(drawingarea, "popup1", al, ac);
   ... here create title, separator and buttons as children of popup1.
   XtAddEventHandler(drawingarea, ..., PostPupup, popup1);
   ... and XtManageChildren.
}


create_popupmenu2(){
   popup2 = XmCreatePopupMenu(drawingarea, "popup2", al, ac);
   ... here create title, separator and buttons as children of popup1.
   XtAddEventHandler(drawingarea, ..., PostPupup, popup2);
   ... and XtManageChildren.
}

   
PostPopup(w, popup, event)
...
{
    switch(event->button){
         case Button3: 
             case Button3:
             XmMenuPosition(popup3, event);
             XtManageChild (popup3);
             break;
        case Button2:
             XmMenuPosition(popup2, event);
             XtManageChild (popup2);
             break;
        default:
            not available
    }
}

Can any one help me what the problem is? The fuuny thing is if I press the 
MIDDLE BUTTON, no response. When I press button1, the noavailabel message
was printed.

WhY That? Thanks.

---Thomas Y, Huang