Array of GtkEntry widgets

        Good day,

        My brain is __DEAD__. In this school project I'm working on I got stuck:

        * have a struct

        struct foo {
                GtkWidget *array_entry;

        * in code I do:

        foo *bar;
        bar = g_malloc (sizeof (foo));
        bar->array_entry = g_new (GtkWidget, 25);

        * then:

        GtkWidget *entry;
        entry = &(bar->array_entry[5]);
        entry = gtk_entry_new ();

        * but, when i want to retrieve text, I do:

        GtkEntry *entry1;
        gchar *str;

        entry1 = GTK_ENTRY (&(bar->array_entry[5]));
        str = g-strdup (gtk_entry_get_text (entry1);

        * and get this error:

        (kendoo:902): GLib-GObject-WARNING **: invalid unclassed pointer        in
cast to `GtkEntry'

        (kendoo:827): Gtk-CRITICAL **: file gtkentry.c: line 3501
        (gtk_entry_get_text): assertion `GTK_IS_ENTRY (entry1)' failed


        P.S. I'm doing it this way, because I don't know how many entry widgets
I need, until the creation of new dialog that hold them (but I used
fixed number here, just to illustrate).

"This is it... This is where I belong..."

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