views:

263

answers:

2

I'm making an app using GTKMM and I want to know how to catch the right click signal from a Gtk::Table ?

And also how to catch if the Mouse is over a Gtk::Table ?

A: 

All GTK+ widgets have the button-press-event and focus-in-event events. You can use the latter, in combination with its complement (focus-out-event) to track if the mouse is inside the widget.

unwind
Can you give me an example how I can do that, sorry i'm new to GTK programming.I have a Window, which has a table inside. So I believe for the window I need to enable the GDK_FOCUS_CHANGE_MASK mask? How do i do that? and then how do I connect the focus-out-event with my table?Thanks.
ace
In my window's constructor I called the function: set_events(Gdk::BUTTON_PRESS_MASK);And In my Table constructor I connected the signal: signal_button_press_event().connect(sigc::mem_fun(*this,bool myTableClass::on_right_click(GdkEventButton* event);However this does not catch the right click.
ace
A: 

Ok I figured out the solution. I was able to capute the right click by overiding the button press event :

virtual bool on_button_press_event(GdkEventButton* event);
ace