Re: GTK_IS_ENTRY failed



On Fri, Jun 28, 2002 at 06:42:49AM +0200, Thomas Ugland wrote:
I'm not sure if this is just a problem with my C skills (inwich isnt
very good yet), or something else. But I anyways try my luck here to see
if anyone can help me out :)

I'm making a GUI that works against a MySQL database. In the initial
start I make a config file, if it doenst exist, fetching various info
(login, pass, etc).

If you see the attached C file you will find that i use an 
GtkWidget *entry[4];

make new entry box'es on them. This works fine and they show up fine in
the gtk window, but when I try to use
gtk_entry_get_text(GTK_ENTRY(entry[0])); it manages to fetch data from
the first 4 entry box'es, but the 5th (entry[5]) it errors with:

(a.out:10441): GLib-GObject-WARNING **: invalid cast from `GtkButton' to
`GtkEntry'

(a.out:10441): Gtk-CRITICAL **: file gtkentry.c: line 3421
(gtk_entry_get_text): assertion `GTK_IS_ENTRY (entry)' failed

my bad? or something else?

Any help appreciated.. :)

-- 
Thomas Ugland

-> If everything is coming your way then you're in the wrong lane. <-

If you have a gtk_entry *entry[4] then there are only four entries,
entry[0], entry[1], entry[2], and entry[3].  Trying to access entry[4]
goes off the end of the array and who knows what you're actually trying
to use at that point.  Glancing at your code you might just need to make
entry an array of 5 elements not 4.  Remember in C arrays are 0 based so
if you have an array of n elements the last element you can access is
n-1.

-Scott

-- 
We are not humanity.
-B



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