Question about entry callbacks



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I am trying to create a callback for an entry widget. When a string
is typed in, I want the callback to be called. I assume that I can
use the entry widget which is passed in with the gtk_entry_get_text
function to get the string. The problem is that when I try to compile,
I get an error which doesn't make sense to me. The code is based on the
example at http://www.gtk.org/tutorial/sec-textentries.html

My call looks like this:

entry_widget = gtk_entry_new_with_max_length(35);
gtk_signal_connect_object (GTK_OBJECT(entry_widget), "activate",
    GTK_SIGNAL_FUNC(GetAccountName), entry_widget);

and the callback looks like this:

void GetAccountName(GtkWidget *widget, GtkWidget *entry_widget)
{
    gchar *account_name;
    account_name=gtk_entry_get_text(GTK_ENTRY(entry_widget));
    g_print(account_name);
}

As far as I can tell, these match the example. I don't really understand
why the first widget gets passed or what it represents, but it doesn't
work without it either.

The error is:

file.cxx:213: type `GtkObject' is not a base type for type `GtkWidget'

Does anyone see where my error is?
- -Vicki
+-----------------------------------------------------------------+
|              E-mail:  vicki thepenguin org                      |
|    My public key - http://www.thepenguin.org/vicki/key.txt      |
|         My Linux page - http://www.thepenguin.org               |
+-----------------------------------------------------------------+
**The best things in life aren't things.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7AY9avFwCsl/kaSARAlOOAKCesBOhsrmXfvEdq6yvezU9FjBOqQCdHEiU
lvPrLCnIKJlJLhnsKnWMAx0=
=T/hT
-----END PGP SIGNATURE-----





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