Re: GtkLabel: setting text



Thank you for your quick response. Exactly, the code is:

  gchar *text;
  gtk_label_get(GTK_LABEL(label),&text);
  score=atoi(text);
  score++;
  sprintf(text,"%d",score);
  printf("%s",text);
  gtk_label_set(GTK_LABEL(label),text);

The "printf" statement assures me "text" to contain the rigth value. 

The 23 Aug 2001 11:30:40 -0400,
Jonathan Blandford <jrb redhat com> wrote:  

Alberto Cabello Sánchez <alberto unex es> writes:

label_set_text(GTK_LABEL(label),"Something");
works as expected. But if I try 

That's right.

gchar *text;
/* doing stuff with text, such as sscanf, strcpy, strcat, etc... */
label_set_text(GTK_LABEL(label),text);

There's something wrong with your code.  What is text, at that point?

-Jonathan





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