Re: Label on a button



On Thu, 2002-07-25 at 13:11, Harring Figueiredo wrote:

 Folks,

 I have a toolbar toogle button, and would like to set the text based on its
state.

 I poked unto the code gtkbutton.c and there is a commnent saying that we now
use have to use:
 GTK_BIN(button)->child.

 I am using the aboce code and casting back to a GTK_LABEL.

 When trying to set the text label (gtk_label_set_text) I get a assertion
saying the it is not a label.

 The button does have a Icon (pixmap) and a label. ( I am using glade to build
it). I printed the GtkType, but I found no way to get what type of widget I get
when calling GTK_BIN(b)->child.


The fact that you have a pixmap and label tells me the child is another
container type and thus why it's not working. If you have naming enabled
in Glade, you may be able to get to the label widget directly from the
main window.

label = gtk_object_get_data (GTK_OBJECT (top_window), "your_label");

-- 
regards,

Luciano Chavez

lnx1138 us ibm com          
http://evms.sourceforge.net




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