how to capture mouse event for a GtkWindow in maemo?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how to capture mouse event for a GtkWindow in maemo?

chunlong yu
I inherit the Gtk::Window ,overwrite it's virtual member function on_button_press_event (GdkEventButton* event) and  on_button_release_event (GdkEventButton* event) ,
and add such codes in the construction function: singal_button_press_event.connect(...)  and singal_button_release_event.connect(....)
or   add such codes in the construction function :add_events(Gdk::EventMask::.......).
 
Neither method can capture mouse event. how can i response mouse event for a GtkWindow in maemo?

_______________________________________________
maemo-developers mailing list
[hidden email]
https://lists.maemo.org/mailman/listinfo/maemo-developers
Reply | Threaded
Open this post in threaded view
|

Re: how to capture mouse event for a GtkWindow in maemo?

Kimmo Hämäläinen
On Sun, 2009-04-19 at 07:00 +0200, ext chunlong yu wrote:

> I inherit the Gtk::Window ,overwrite it's virtual member function
> on_button_press_event (GdkEventButton* event) and
> on_button_release_event (GdkEventButton* event) ,
> and add such codes in the construction function:
> singal_button_press_event.connect(...)  and
> singal_button_release_event.connect(....)
> or   add such codes in the construction function :add_events
> (Gdk::EventMask::.......).
>  
> Neither method can capture mouse event. how can i response mouse event
> for a GtkWindow in maemo?

Maybe the Gtk tutorial helps. See e.g. the Scribble example program:
http://library.gnome.org/devel/gtk-tutorial/stable/x2433.html
You connect to the "button_press_event" signal to get the mouse button
press.

BR; Kimmo


_______________________________________________
maemo-developers mailing list
[hidden email]
https://lists.maemo.org/mailman/listinfo/maemo-developers
Reply | Threaded
Open this post in threaded view
|

Re: how to capture mouse event for a GtkWindow in maemo?

Murray Cumming
In reply to this post by chunlong yu
On Sun, 2009-04-19 at 13:00 +0800, chunlong yu wrote:
> I inherit the Gtk::Window ,overwrite it's virtual member function
> on_button_press_event (GdkEventButton* event) and
> on_button_release_event (GdkEventButton* event) ,

There are no such default signal handler virtual functions in the maaemo
version of gtkmm:
http://maemomm.garage.maemo.org/docs/tutorial/html/ch04s02.html

> and add such codes in the construction function:
> singal_button_press_event.connect(...)  and
> singal_button_release_event.connect(....)

You probably need to connect "after":
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/sec-xeventsignals.html

> or   add such codes in the construction
> function :add_events(Gdk::EventMask::.......).

Note that you can only use add_events() after the widget has been
realized. For instance, in a signal_realize signal handler.

> Neither method can capture mouse event. how can i response mouse event
> for a GtkWindow in maemo?



--
[hidden email]
www.murrayc.com
www.openismus.com

_______________________________________________
maemo-developers mailing list
[hidden email]
https://lists.maemo.org/mailman/listinfo/maemo-developers