Hi,<br><br>I would like some help to solve a GTK+ problem, since I am working with this GUI library for the first time.<br><br>I want to create some clickable boxes with a background image. I am using a GtkEventBox with a GtkImage inside, as I read on the API. This is my function for setting the background image:<br>
<br>static void set_box_image(struct game_data *d, gint box_index, gint img_index) {<br>    gchar file[40];<br>    sprintf(file, &quot;/usr/share/pixmaps/100boxes/%d.png&quot;, img_index);<br>    GtkWidget *img = gtk_image_new_from_file(file);<br>
    GtkWidget *old = gtk_bin_get_child(GTK_BIN(d-&gt;base[box_index]));<br>    if (old != NULL) {<br>        gtk_widget_destroy(GTK_WIDGET(old));<br>    }<br>    gtk_container_add(GTK_CONTAINER(d-&gt;base[box_index]), GTK_WIDGET(img));<br>
    gtk_widget_show(img);<br>}<br><br>where d-&gt;base is an array of GtkEventBox items.<br><br>The problem is that sometimes the images appear with inverted colors (i.e. in negative). It happens in an inconsistent manner, I have not been able to spot the cause so far.<br>
I suspect it has to do with GtkWidget states, so I tried to set the state programmatically (both for the GtkEventBox and the GtkImage), but that did not solve the problem.<br><br>Thanks for your attention.<br>Best wishes<br>
Floriano<br><br>---<br>Floriano Scioscia<br>