gtk_entry_set_text used twice or more
- From: author <millward Ms UManitoba CA>
- To: gtk-app-devel-list gnome org
- Subject: gtk_entry_set_text used twice or more
- Date: Thu, 4 Oct 2001 06:58:10 -0500
I'm just learning GTK from the online tutor and writing my
own experiment programs.
I have a small problem with the Text Entry Widget.
I want to display a message on it, then sleep 10 seconds,
then display another different message on it.
The first message is a character string.
The second is the result of a calcuation converted to
a character string.
void callback2(GtkWidget * widget, GtkWidget * entry )
{
double dub = 0.0;
char savebuf[50];
gchar * xx;
gchar * yy = "This is callback2... ";
xx = gtk_entry_get_text(GTK_ENTRY(entry) );
g_print("\nEntry Contents > %s\n", xx);
dub = process(xx);
/* The next line is not executed. Why? */
gtk_entry_set_text(GTK_ENTRY(entry), yy);
sleep(10); /* in <unistd.h> */
sprintf(savebuf,"%g",dub); /* in <stdio.h> */
gtk_entry_set_text(GTK_ENTRY(entry), (gchar *) savebuf );
}
The g_print message gets onto the xterm command line,
then the program waits 10 seconds and displays the
result of the calculation in the Entry Widget, but
the line :
gtk_entry_set_text(GTK_ENTRY(entry), yy);
is skipped and does nothing.
Why? Can anyone tell me why the string is not displayed?
This program compiles clean with no warnings.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]