Re: About gtk_label_set_text()



I'm trying to write a simple application. One button with label "1", and
every time the user do a click on it, the label must increase the label
by one. 1 --> 2 --> 3 etc...

I have found that I only can use a const string
(gtk_label_set_text(label, "anything") but no way to do what I say. How
can I do that.

Something like this will do:
Carlos

--------------------------------------------------
void callback (GtkWidget *widget, gpointer data)
{
GtkWidget *label = GTK_BIN (widget)->child;
char string [MAX_CHAR];
static int i = 1;

sprintf (string, "%d", ++i);
gtk_label_set_text (GTK_LABEL (label), string);
}
---------------------------------------------------




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