enquiry about labels
- From: Pierre CHATEL <addicted2 wanadoo fr>
- To: GTK <gtk-list gnome org>
- Subject: enquiry about labels
- Date: 24 Nov 2002 18:27:23 -0500
Hello,
...and sorry for such a silly question but i'm quite new to GTK and C in
general...
I want to use gtk_label_set_text (from gtk 1.2) in a callback function
in order to change a button's label, but it seems i can only use
'constant' strings like "hello world" with this function but no char *
variables.
So the following procedure's not working at all:
/*decrement the value of the label by 1*/
void
on_button_click_event2 (GtkWidget *button, gpointer label)
{
char *str;
int i;
gtk_label_get(label,&str);
i = atoi(str);
i--;
sprintf(str,"%i",i);
g_print("%s",str);
gtk_label_set_text(GTK_LABEL(label),str);
/* no change of the button's label at this point !!*/
}
But gtk_label_set_text(GTK_LABEL(label),"xxx"); is working !!
Is there a way i can achieve that with an other function (or even this
one ?)
Thanks,
Pierre
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]