Re: [gtk-list] Pixmap



In message <38C51118.3B69C8B9@solar.com.br>you write:
>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

a pixmap is not a window. even if had a signal such as "clicked", it
could not generate it because, having no window, it will never be
recipient of the "lower level" X/Gdk events that eventually may lead
to a "clicked" being sent.

you need to put the container into an event box, and set the events
for the event box to include BUTTON_RELEASE_MASK, and connect to
"button-release" of the event box.

"clicked" is a special signal that as far as i know only buttons
generation.

--p



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