Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!uflorida!mephisto!gatech!galbp!samna!jeff From: jeff@samna.UUCP (Jeff Barber) Newsgroups: comp.windows.x Subject: Re: problems with event handler in Motif 1.0.a Message-ID: <268@samna.UUCP> Date: 13 Apr 90 19:00:18 GMT References: <792@bredex.UUCP> Reply-To: jeff@samna.UUCP (Jeff Barber) Organization: Draughtsman's Contractors Lines: 36 In article <792@bredex.UUCP> uwe@bredex.UUCP (Uwe Faustmann - BREDEX GmbH) writes: >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 This happens on my system too (386 running ISC 386/ix w/Motif). Here's what I figured out: Someone/something is issuing an XGrabButton on Button3 on the window associated with the Form widget. I figured this out by implementing my own XtMainLoop and printing out the events. If you look at all of the events caused by pressing the button inside the Label widget's window, you'll notice that the first two events are Leave and Enter followed by the actual ButtonPress of Button1 delivered to the FormWindow. If you press (and hold) Button1 or Button2 first, the passive Grab is not activated and so the ButtonPress is delivered to the Label Window (as you expect). Anyway, that's what's happening - someone with source will have to tell you where/why the grab call is being made and how to work around it. Jeff