Re: entry problem



You should Use.
*** function to get string***
static gchar *entry_text;(global to file)
void get_the_text (GtkWidget *widget, GtkWidget *entry)
{
  entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
  printf("Entry contents: %s\n", entry_text);
}


****main****
char *v;
entry1 = gtk_entry_new_with_max_length (50);
button = gtk_button_new_with_label ("gettext");
v= gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
                               GTK_SIGNAL_FUNC(get_the_text ),
                               GTK_OBJECT (entry1));

Bye 
Amit Jain

----- Original Message ----- 
From: "Mauro Venanzi" <jjfnet libero it>
To: <gtk-list gnome org>
Sent: Sunday, December 01, 2002 8:27 PM
Subject: entry problem




hi list
i have done a simple gtk text entry
i would like to get string from the text entry after a  button pressed
this is the code :

*** function to get string***
void get_the_text (GtkWidget *widget, GtkWidget *entry)
{
  gchar *entry_text;
  entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
  printf("Entry contents: %s\n", entry_text);
 return entry_text;
}


****main****
char *v;
entry1 = gtk_entry_new_with_max_length (50);
button = gtk_button_new_with_label ("gettext");
v= gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
                               GTK_SIGNAL_FUNC(get_the_text ),
                               GTK_OBJECT (entry1));
****i tried also***
v= gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
                               GTK_SIGNAL_FUNC(get_the_text ),
                               entry1);

it segfauls and doens't work
have you suggest??
how can i modify the program?
thanks








-- 


----
*************************************************************
                      Universe Creation 
 ....and God wrote:
                      tar -Uvh BigBeng.tar.gz
#############...unpacking..######################
*************************************************************
Mauro Venanzi linux ru250233
hall2001 athlon-xp rm 135009 on Suse 8.1


_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list





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