Re: swap images on click event.
- From: Craig Harding <charding mun ca>
- To: Craig Harding <charding mun ca>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: swap images on click event.
- Date: Sun, 11 Dec 2005 02:06:59 -0330
Got it working. I made an event box for each button and hid and showed each one when needed. Thanks
for your help earlier.
craig.
Craig Harding wrote:
Sorry for the delay on this, but I'm still in exams. :) When I add both
GtkImages to the applet, and run the program I get the following:
------
(xmms-applet:17352): Gtk-WARNING **: Attempting to add a widget with
type GtkImage to a GtkEventBox, but as a GtkBin subclass a GtkEventBox
can only contain one widget at a time; it already contains a widget of
type GtkImage
-----
When the gtk_widget_hide and gtk_widget_show functions are called, the
button is hidden, but when the other button is supposed to show, it
doesn't.
Craig.
Yury Aliaev wrote:
Craig Harding scripsit:
Ok, how can I show/hide the images? This is a breakdown of the code
I'm working on:
--------------
play_button = gtk_image_new_from_file ("/usr/local/pixmaps/play.png");
pause_button = gtk_image_new_from_file("/usr/local/pixmaps/pause3.png");
hbox = gtk_hbox_new(FALSE,0);
play_event_box = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (play_event_box), play_button);
gtk_container_add (GTK_CONTAINER (play_event_box), pause_button);
gtk_box_pack_start(hbox, play_event_box, FALSE, FALSE, 2);
gtk_container_add (GTK_CONTAINER (applet), hbox);
gtk_widget_show_all (GTK_WIDGET (applet));
/* This should be added here otherwise all images will be shown
simultaneously. */
gtk_widget_hide (pause_button); // or play_button
g_signal_connect (G_OBJECT (play_event_box), "button_release_event",
G_CALLBACK (on_play_button_press), pause_button);
g_signal_connect (G_OBJECT (play_event_box), "button_release_event",
G_CALLBACK (on_play_button_press), play_button);
static gboolean on_play_button_press (GtkWidget
*event_box,GdkEventButton *event,gpointer data) {
// do show/hide stuff here....? how do I do it?
Just use gtk_widget_hide()/gtk_widget_show() functions with
appropriate arguments.
}
Regards,
Yury.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]