ButtonPressEvent not working ...

View: New views
3 Messages — Rating Filter:   Alert me  

ButtonPressEvent not working ...

by thura :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, everyone .. I have some probs with ButtonPressEvent ...
Here is snippet http://pastebin.com/m3a029be9 ...
But, when it runs, the context menu doesn't show up ...
I have tried replacing ButtonPressEvent with KeyPressEvent, it works ...
Any clues ?

------------------------------------------------------------------------------
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
java-gnome-developer@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-developer

Re: ButtonPressEvent not working ...

by Andrew Cowie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
java-gnome-developer@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-developer

signature.asc (204 bytes) Download Attachment

Re: ButtonPressEvent not working ...

by thura :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Wed, Sep 23, 2009 at 6:21 PM, Andrew Cowie <andrew@...> 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&reg; 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&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
java-gnome-developer mailing list
java-gnome-developer@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-developer


Thanks for the tip, it works now ;)

Thura

------------------------------------------------------------------------------
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
java-gnome-developer@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-developer