GtkCombo Win32

Ok I seem to be having some problems with the gtkcombo drop down menu I get the following errors when I try to do a gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combobox)->entry), "string");

error: GtkCombobox.exe (pid:1628): Gtk-CRITICAL **: file gtkentry.c: line 3273 (gtk_entry_set_text): assertion `GTK_IS_ENTRY (entry)' failed

and when I try to connect a activate signal to entry I get a entry is null error is there a reason for this? Possibly me just doing some thing wrong?

heres the code that gave me the error. 

#include <gtk/gtk.h>

void select_print (GtkWidget *widget, GtkWidget *entry);

main (gint argc, gchar *argv[])
    GtkWidget *window;
    GtkWidget *combobox;
    GList *glist = NULL;

    gtk_init (&argc, &argv);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title (GTK_WINDOW (window), "GtkCombobox");
    g_signal_connect (G_OBJECT (window), "destroy",
                      G_CALLBACK (gtk_main_quit),

    combobox = gtk_combo_new ();
    /*GTK_COMBO (combobox)->entry = gtk_entry_new ();*/
    glist = g_list_append (glist, "AM");
    glist = g_list_append (glist, "PM");
    gtk_combo_set_popdown_strings (GTK_COMBO (combobox), glist);
    /*gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combobox)->entry), "AM");*/

    g_free (glist);

    gtk_combo_set_use_arrows (GTK_COMBO (combobox), TRUE);
    gtk_container_add (GTK_CONTAINER (window), combobox);
    g_signal_connect (G_OBJECT (GTK_COMBO (combobox)->entry), "activate",
                      G_CALLBACK (select_print), combobox);

    gtk_widget_show (combobox);
    gtk_widget_show (window);

    gtk_main ();
    return 0;


void select_print (GtkWidget *widget, GtkWidget *combo)
    g_print ("\n combobox set to: %s \n", gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (combo)->entry)));

also I get a entry null error in gtk_entry_get_text, any help with this would be greatly aprecated

thx in advance.     

Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year.

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