Re: [gtk-list] button with label



On Thu, Dec 17, 1998 at 04:16:09PM -0800, Gorka Urrutia wrote:
> Hi,
> 
> When I create a button with:
> 
> gtk_button_new_with_label( "Open" );
> 
> how can I get the value of the label later?
> and how can I change its value?
> 
> Thanks.

Get the label widget (which is a child of the button) like this:

GtkWidget *label;
GtkWidget *button;

button = gtk_button_new_with_label ("Open");
label = GTK_BIN (button)->child;

Then use GtkLabel functions to change the value or get the
string:

gtk_label_get (GTK_LABEL (label), &str);
gtk_label_set_text (GTK_LABEL (label), "New");

-Shawn

--
Shawn T. Amundson               
amundson@gimp.org               http://www.gimp.org/~amundson

"The assumption that the universe looks the same in every
 direction is clearly not true in reality." - Stephen Hawking



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