Re: Change an image on a button
- From: "Ed Catmur" <ed catmur co uk>
- To: Guillaume Charhon <pub charhon wanadoo fr>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Change an image on a button
- Date: Wed, 15 Nov 2006 10:33:28 +0000
Guillaume Charhon writes:
I've some problems to change an image on a button.
See the example :
gtk_button_set_image(GTK_BUTTON(theButton), ImageOne); // ok
gtk_button_set_image(GTK_BUTTON(theButton), ImageTwo); // ok
gtk_button_set_image(GTK_BUTTON(theButton), ImageOne); // ImageOne
doesn't appear !
GtkImage, like other GtkWidgets, is created floating. The first call to
gtk_button_set_image() sinks the floating ref, then the second call unrefs
it and the GtkImage ImageOne is destroyed. This method is used because it
simplifies refcount handling for the usual case. If you want to reuse
ImageOne you need to ref or sink it yourself.
Ed Catmur
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]