Re: [gtk-list] Button events from Preview widget



> 
> I'm using Gtk--, but I presume that the principle is the same as using raw
> C GTK.

You may consider upgrading to gtk-- 1.1.8.  Our stable is 
too far out of date to field most questions because a number
of features like events don't work well.  1.1.8 is largely
considered to be the pre-stable.
> 
> The code which creates the widget includes the following:
> 
>   preview=new Gtk_Preview(GTK_PREVIEW_GRAYSCALE);
>   preview->size(600,600);
>   connect_to_method(preview->button_press_event,this,&previewPress);
>   connect_to_method(preview->button_release_event,this,&previewRelease);
>   pack_start(*preview,FALSE,FALSE,4);
>   preview->show();
> 
> 
> The raw "pack_start" call is because my class is derived from the HBox
> class.  The widget is created and appears.  However, my two callbacks (the
> methods "previewPress" and "previewRelease") never get called, even when I
> try clicking within the widget.

> Can anybody suggest what I've neglected here?

A few possiblities.  First you may not have set the event mask 
properly (or at all.)  Without an event mask to capture tell X
to send the events you can't capture them.  Also a likely possiblity
that preview does not have an X window and therefore can't receive
thos kinds of events.  Not all widgets can get all events and
often it isn't clear which.  (Generally misc widgets can not, 
others are more mixed.)  If this is the case, place the widget in
an Event Box which can capture the events for you.

--Karl Nelson
  Gtk-- Lead Developer



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