Combo Box gives error messages
Hello In the application I'm writing, I have included several Combo Boxes. They are all written like this: main { GtkWidget *pComboRange, *pFrame; ... pFrame = gtk_frame_new("Zoom Range"); pComboRange = gtk_combo_box_new_text(); gtk_container_add(GTK_CONTAINER(pFrame), pComboRange); gtk_box_pack_start(GTK_BOX(pHBox[4]), pFrame, TRUE, TRUE, 0); gtk_combo_box_append_text(GTK_COMBO_BOX(pComboRange), "1000 Hz"); gtk_combo_box_append_text(GTK_COMBO_BOX(pComboRange), "2000 Hz"); gtk_combo_box_append_text(GTK_COMBO_BOX(pComboRange), "4000 Hz"); gtk_combo_box_set_active(GTK_COMBO_BOX(pComboRange), 2); g_signal_connect( G_OBJECT(pComboRange), "changed", G_CALLBACK( cb_range_changed ), NULL ); ... } Changing the value of the Combo Box call the function: void cb_range_changed(GtkWidget *combo, gpointer data) { gint index = gtk_combo_box_get_active(GTK_COMBO_BOX(combo)); if (index == 0) { zoomFactor = 1; } else if (index == 1) { zoomFactor = 2; } else if (index == 2) { zoomFactor = 4; } } The app compiles OK and works exactly as I want, but if I start the app in a terminal, I have these messages every time I use the Combo Boxes : GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GObject' GLib-GObject-CRITICAL **: g_object_get_data: assertion `G_IS_OBJECT (object)' failed This happens even if I compile it without the 'g_signal_connect' line, which shows, I guess, that the problem is in the 'main' file and not in the 'cb_range_changed' function. Please is this normal? Where does it come from? Should I fix something in my code? Thank you very much Victor ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
RE: Change background color in GTK 3
Well I had the issue on ubuntu 11.10. On another machine using ubuntu 11.04 it works... Is it related to theme? Anyway should't gtk_widget_override_background_color override theme? Victor > Date: Mon, 13 Feb 2012 16:39:02 -0800 > From: nada...@hotmail.com > To: gtk-list@gnome.org > Subject: Change background color in GTK 3 > > > Hello > > I would like to change the background of a button in GTK3 > > In GTK2, I was doing : > > GdkColor color; > gdk_color_parse ("gold",&color); > gtk_widget_modify_bg(GTK_WIDGET(widget), GTK_STATE_NORMAL, &color); > > and it was working perfectly. > > In GTK3, I am doing : > > GdkRGBA color; > gdk_rgba_parse (&color, "orange"); > gtk_widget_override_background_color(GTK_WIDGET(widget), > GTK_STATE_FLAG_NORMAL, &color); > > and it doesn't work. I don't understand what I have missed > > Thank you > > -- > View this message in context: > http://old.nabble.com/Change-background-color-in-GTK-3-tp33319146p33319146.html > Sent from the Gtk+ - General mailing list archive at Nabble.com. > > ___ > gtk-list mailing list > gtk-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
RE: Change background color in GTK 3
Thank you Jean Victor > > This is https://bugzilla.gnome.org/show_bug.cgi?id=656461 > > Regards, > Jean > > > > > > > Hello > > > > > > I would like to change the background of a button in GTK3 > > > > > > In GTK2, I was doing : > > > > > > GdkColor color; > > > gdk_color_parse ("gold",&color); > > > gtk_widget_modify_bg(GTK_WIDGET(widget), GTK_STATE_NORMAL, &color); > > > > > > and it was working perfectly. > > > > > > In GTK3, I am doing : > > > > > > GdkRGBA color; > > > gdk_rgba_parse (&color, "orange"); > > > gtk_widget_override_background_color(GTK_WIDGET(widget), > > > GTK_STATE_FLAG_NORMAL, &color); > > > > > > and it doesn't work. I don't understand what I have missed > > > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list