Re: changing the label of a button



On 18 Mar 2001, Matt Gerginski wrote:

does anyone know how to go about changing the label on a gtk_button
after it has been  created??  i tried putting a gtk_label on the button,
but that didnt work.  Thanks.

 If you used a "blank" button and put a label in it, thus:

button = gtk_button_new ();
label = gtk_label_new ("GTK");
gtk_container_add (GTK_CONTAINER (button), label);

 you can modify the label, with this function: 

 gtk_label_set_text (GtkLabel *label,
                     char     *str);

 In our exemple:

gtk_label_set_text (GTK_LABEL (label),
                    "GTK+");


- Capitulino





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