Re: GtkLabel: setting text



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

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. 

Are you going right back to the main loop after this?  One frequent
mistake is to do a:
for (i = 0; i < 100; i++) {
        update_label ();
};

and expect the updated label to appear.

-Jonathan




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