Re: [Java-gnome-developer] ButtonPressEvent not working ...
Brought to you by:
afcowie
From: Thura <thu...@gm...> - 2009-09-24 10:57:39
|
On Wed, Sep 23, 2009 at 6:21 PM, Andrew Cowie < an...@op...> wrote: > On Wed, 2009-09-23 at 08:37 -0400, Thura wrote: > > But, when it runs, the context menu doesn't show up ... > > I have tried replacing ButtonPressEvent with KeyPressEvent, it > > works ... > > You've been bitten by the well known beginner's pitfall > > "my example is so trivial that not everything that would be > present in a real application is there, so things that would > normally work fine appear not to be working at all" > > In this case, you've not got enough packed into your top level Window to > make it behave. In fact, you haven't got _anything_ packed into your top > level Container. So, really, it's not that surprising that not > everything is working. > > Quick solution: > > Pack an EventBox into your top level Window and connect your > Widget.ButtonPressEvent handler to that instead. I tried it, works fine. > > Underlying issue: > > Ordinarily you don't have to think about this as normal GTK Widgets take > care of this, but your problem was that the underlying GDK Window > backing the GTK Window hasn't been setup to react to mouse events. There > are a few branches floating around with different suggestions about how > to offer direct access to that API, but you don't need any of that; just > add an EventBox - it's there to give Widgets that don't have event > handling (ie, Labels) events. > > AfC > Sydney > > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer > > Thanks for the tip, it works now ;) Thura |