Re: enquiry about labels



There Is correction my last answers.
You should use
 gtk_label_get(GTK_LABEL(GTK_BIN(button)->child), &label );
gtk_label_set(GTK_LABEL(GTK_BIN(button)->child), label );
 Since GtkButton contains GtkLabel as a child so you have to use
 this above line.
apalogy
 Bye
 Amit Jain

----- Original Message -----
From: "amitjain" <amitjain webdunia com>
To: "Pierre CHATEL" <addicted2 wanadoo fr>; "GTK" <gtk-list gnome org>
Sent: Monday, November 25, 2002 9:57 AM
Subject: Re: enquiry about labels


> You should use
> gtk_label_get(GTK_LABEL(GTK_BIN(button)->child), &label );
> gtk_label_set(GTK_LABEL(GTK_BIN(button)->child), label );
> Since GtkLabel contains GtkLabel as a child so you have to use
> this above line.
> Bye
> Amit Jain
>
> ----- Original Message -----
> From: "Pierre CHATEL" <addicted2 wanadoo fr>
> To: "GTK" <gtk-list gnome org>
> Sent: Monday, November 25, 2002 4:57 AM
> Subject: enquiry about labels
>
>
> > 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
> >
> > _______________________________________________
> > gtk-list mailing list
> > gtk-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-list
> >
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>




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