Re: swap images on click event.

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));

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?



thanks for any help,

Yury Aliaev wrote:
Craig Harding scripsit:

Hi, I'm trying to change an image with another when I click on my applet button, but it doesn't work, can anyone help me out?

You may implement this by the easier way (IMHO): add the vbox or the hbox to your container, pack _both_ images in this box and show only the required image hiding another one.

gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

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