Path: utzoo!attcan!uunet!cs.utexas.edu!rice!uw-beaver!Teknowledge.COM!unix!hplabs!hp-pcd!hpcvlx!gabe From: gabe@hpcvlx.cv.hp.com (Gabe Begeddov) Newsgroups: comp.windows.x Subject: Re: problems with event handler in Motif 1.0.a Message-ID: <100920207@hpcvlx.cv.hp.com> Date: 13 Apr 90 21:50:36 GMT References: <792@bredex.UUCP> Organization: Hewlett-Packard Co., Corvallis, OR, USA Lines: 52 / hpcvlx:comp.windows.x / uwe@bredex.UUCP ( BREDEX GmbH) / 3:11 am Apr 12, 1990 / Dear xperts, we have a problem using popup menus in Motif. The program attached below should do the following: - use a form widget with an included label widget - add an event handler(ButtonPress) to the form and the label - popup a different menu dependend on the widget the mouse button was pressed on What actually happens is a bit strange: if you use MB3 on the form, all is as expected if you use MB3 on the label, the event handler is called, but the widget id is that of the form if you press MB2 and then MB3, you get the right widget id There is no support for nested popup menus that use the same button in motif. The menus use a passive grab on the widget that they are popped up from. If an ancestor widget already has a passive grab for same event then it will be given to the ancestor widget by the server. When you press the MB2 first it activates an automatic grab which allows the MB3 press to be sent to the window it occurred in rather than the ancestor window that has a passive grab for it. If you were to press MB2 in the label and then move the pointer to another widget then this would be the one that got the MB3! If you must use nested menus and don't need the grab functionality (i.e. pop up this menu when the user presses the button in this widget or any of it's descendants) then you could create the menus off of some non-related widget and select for button events on the widgets that you are interested in and then pop them up. If you do this you will also lose the ability to have accelerators and mnemonics since these also use the grabs on the widget they are parented from. Another alternative is to use different buttons for the different menus. In Motif 1.0 you will be able to specify modifiers for the popup button and thereby have more possible menus without losing grab support. Thanks, Uwe \|||/ Uwe Faustmann, Bredex GmbH o o Braunschweig, West Germany > uwe@bredex.uucp Gabe Beged-Dov Interface Technology Operation Hewlett Packard Corvallis, Or (Home of the HP-UX New wave Desktop)