Re: Array of GtkEntry widgets
- From: Todd Kulesza <todd dropline net>
- To: Vladimir Djokic <vladeck sezampro yu>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Array of GtkEntry widgets
- Date: Thu, 26 Dec 2002 16:10:49 -0500
It looks like you need an array of pointers, not just a single pointer.
Try:
struct foo
{
GtkWidget **array_entry;
};
and then:
array_entry = g_new0 (GtkWidget *, number_of_objects);
which can then be accessed as follows:
array_entry [0] = gtk_entry_new ();
array_entry [1] = gtk_entry_new ();
and so on.
Todd
Vladimir Djokic wrote:
Good day,
Developers!
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
Anybody?
THANKS!
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).
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]