Re: adding button events to a gtkdrawingarea based gobject



On 14 February 2011 13:20, James Morris <jwm art net gmail com> wrote:
Hi,

(forgive some imprecise names here, am writing from memory and in a
rush before work)

I'm adapting some code which uses gobject to create a widget. The code
previously used GtkWidget as the parent_class but I am trying to adapt
it to GtkDrawingArea as the parent_class.

However, the button_press_event code is no longer activated within the
custom widget now that it's a drawing area. How do I activate it?

I know with an ordinary GtkDrawingArea if I want to add
button-press-events to use gtk_add_events, but the code that uses the
custom widget shouldn't need to do this and besides the widget needs
to connect to it's own internal private implementation code anyway so
gtk_add_events is obviously wrong.

Can anyone provide some pointers please?

Yes James, just add the call to gtk_widget_add_events into the
yourwidget_init function.

HTH!



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