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



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 =
        gtk_container_get_children(GTK_CONTAINER(w_fs_button));
    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.

Chris



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