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

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

 



I have now tested and indeed this solved the problem with GtkFileChooserButton. But I wasn't as luck with GtkCombobox, which  inherits from a GtkBin and adds a GtkCellView as a child. Neither without any GdkWindow. It does add a button, which is connected to the GtkBin through as gtk_widget_set_parent. But this button does not appear in gtk_container_get_children(). Sigh. Gtk does have transparency issues...

Any ideas?

Regards,
Dov

2009/5/26 Dov Grobgeld <dov.grobgeld@xxxxxxxxx>
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,
Dov

2009/5/26 Chris Vine <chris@xxxxxxxxxxxxxxxxxxxxx>

On Mon, 25 May 2009 06:46:34 +0300
Dov Grobgeld <dov.grobgeld@xxxxxxxxx> 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



_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://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