Re: Events in custom widgets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Il Thu, 14 Jan 2016 08:41:46 +0100 Jozef Molnar <jv.molnar@xxxxxxxxxxxxxx> scrisse:

> Dear subscribers,
> 
> I want to create a custom widget derived from either GtkDrawingArea or
> GtkLayout (still do not know, which is better for my purpose - I need some
> advice).
> Nevertheless, if I derive my widget from GtkDrawingArea, I can draw using
> Cairo (the draw callback gets called) but I cannot receive mouse events. I

Hi Jozef,

GtkDrawingArea *can* handle mouse events. From its documentation:

    To receive mouse events on a drawing area, you will need to
    enable them with gtk_widget_add_events().

so I suspect you are missing that call in your testing code. E.g.

    gtk_widget_add_events(drawing_area, GDK_POINTER_MOTION_MASK);

enables you to connect a callback to the "motion-notify-event"
signal of your drawing area.

Ciao.
-- 
Nicola
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list



[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux