Re: [gtk-list] Pixmap




Pedro Medeiros <pjira@solar.com.br> writes:

> What should I do to set a GDK_BUTTON_PRESS_MASK signal for a GtkPixmap?
> 
>       GtkWidget *pixmap;
>       (...)
>       gtk_widget_show (GTK_WIDGET (pixmap));
>       gtk_fixed_put (GTK_FIXED (widget), GTK_WIDGET (pixmap), x, y);
>       gtk_widget_set_uposition (GTK_WIDGET (pixmap), x, y);
>       gtk_widget_set_events (GTK_WIDGET (pixmap),
>                              GDK_BUTTON_PRESS_MASK);
>       gtk_signal_connect (GTK_OBJECT (pixmap),
>                           "clicked", GTK_SIGNAL_FUNC (click_cell),
> NULL);
> 
> Gtk-CRITICAL **: file gtkwidget.c: line 3819 (gtk_widget_set_events):
> assertion
> `!GTK_WIDGET_NO_WINDOW (widget)' failed.
> 
> Gtk-WARNING **: gtk_signal_connect(): could not find signal "clicked" in
> the
> `GtkPixmap' class ancestry

GtkPixmap is a NO_WINDOW widget. This means that it has no associated
GdkWindow and cannot catch events. The solution is to put your 
pixmap inside a GtkEventBox and catch the events on the EventBox.

Regards,
                                        Owen



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