Combo Box gives error messages

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

 



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@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux