Re: Passing Values ?
- From: Elizabeth Barham <lizzy soggytrousers net>
- To: pgmoscatt optushome com au
- Cc: GTK App Dev List <gtk-app-devel-list gnome org>
- Subject: Re: Passing Values ?
- Date: 26 Apr 2003 10:17:46 -0500
Peter writes:
The code I am using is as follows:
gchar m;
GtkWidget *entry_connect;
m=gtk_entry_get_text(entry_connect);
When run it returns a critical error.
Rightly so! entry_connect is just a pointer and since it has not
been initialized it may point to anywhere in core.
GtkWidget * entry_connect = gtk_entry_new();
m = gtk_entry_get_text(GTK_ENTRY(entry_connect));
Also how do I know that 'entry_connect' is in fact the same one
which has been declared in another header file:
GtkWidget *create_commswindow (void)
{
GtkWidget *commswindow;
GtkWidget *entry_connect;
...
}
They're just pointers, not objects. Once you make an object then
you're free to pass pointers to it around the program.
Am I trying to access the right control as from what I can see is
that 'entry_connect' is a local variable.
Yes, it is, but once you have the GtkEnty object initialized and
floating about in core then you may access it from anywhere provided
you are able to retrieve its location.
GtkWidget *create_commswindow (void)
{
GtkWidget *commswindow;
GtkWidget *entry_connect;
...
return(entry_connect);
}
GtkWidget * my_entry = create_commswindow();
gchar * m = gtk_entry_get_text(GTK_ENTRY(my_entry));
Elizabeth
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]