Re: Having an event box pass unhandled events to its child

Thanks! Now this is obvious. I should have thought of that. All that is needed is to look at the gtkfilechooserbutton.h or the .c file for that matter. The code you suggested works fine for my purpose, i.e. to add a right click menu to any widget. I might amend it to do a recursive descent on any GTK_CONTAINER.

Thanks again,

2009/5/26 Chris Vine <chris cvine freeserve co uk>
On Mon, 25 May 2009 06:46:34 +0300
Dov Grobgeld <dov grobgeld gmail com> wrote:

> I did. See my message to the list from 21 May 2009 20:04 with the
> subject "Doing right click on some widgets doesn't work". That
> program creates two buttons. One "normal" and one "file chooser
> button". I attach the same signals to them, but the signal handler
> for button-press-event is never called for the file chooser button. I
> thought I understood signals in gtk by now. But this one beats me...

GtkFileChooserButton is just an GtkHBox object.  You need to connect to
the widget(s) in the GtkBox which receive events (ie which have a
GdkWindow object). For example amending your code for connecting to
w_fs_button to this works:

   GList* children =
   for (children = g_list_first(children); children; children =
        g_list_next(children)) {
           g_signal_connect(children->data, "button-press-event",
                            G_CALLBACK(cb_button_press_event), NULL);

However, I suggest you are a little more discriminating and look at the
code for GtkFileChooserButton to find out which widget in particular is
receiving events and connect to that one.


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