Oops I got troubled with
g_ascii_strncasecmp()...didn't want to compile saying the following.
Code:
error C2198: 'g_ascii_strncasecmp' : too few actual parameters
I used strcmp() to fix this out...ok it is working now. :)
Ok as you know I'm building my application step by step as I'm new to GTK+. In fact, I added another GtkImage widget on the same window. The thing is that when I choose let say Chair from the combo box, the two GtkImage widgets should display two different images (for e.g. one displays the actual chair and the other displays the chair in wireframe - so 2 different images pertaining to Chair). In fact for each item (Chair, Table, Bed, etc) there will be 2 different images.
So I modified the code as below.
Code:
void
on_cbo_pickobject_changed (GtkComboBox *combobox,
gpointer user_data)
{
gchar *mystr;
mystr = gtk_combo_box_get_active_text (combobox);
if (strcmp (mystr, "Chair") == 0)
{
GtkWidget *myimage_object = lookup_widget(GTK_WIDGET(combobox), "img_objectpreview");
gtk_image_set_from_file (GTK_IMAGE(myimage_object), "Pictures/Chair 1.jpg");
GtkWidget *myimage_pattern = lookup_widget(GTK_WIDGET(combobox), "img_patternpreview");
gtk_image_set_from_file (GTK_IMAGE(myimage_pattern), "Pictures/Chair 1.gif");
}
else if (strcmp (mystr, "Table") == 0)
{
/* show table image */
}
else
{
/* show default image */
}
/* we have to free the memory used from the return from the
call to gtk_combo_box_get_active_text() */
g_free (mystr);
}
Unfortunately, I'm getting the following 2 errors.
Code:
error C2275: 'GtkWidget' : illegal use of this type as an expression
error C2065: 'myimage_pattern' : undeclared identifier
It seems that it is not accepting as from...
Code:
GtkWidget *myimage_pattern = lookup_widget(GTK_WIDGET(combobox), "img_patternpreview");
gtk_image_set_from_file (GTK_IMAGE(myimage_pattern), "Pictures/Chair 1.gif");
Any idea? :idea: