Re: Label on a button




 Luciano, 

  Thanks for the hint, but I think that this is not possible. There is no way
to "name" the label -- I am using Glade 6.4 --. Here is the code that Glade
generates.

==========code================
 tmp_toolbar_icon = create_pixmap (window1, "_cdrom.xpm");
  toolbar_start_button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar1),
                                GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
                                NULL,
                                "Start",
                                "Start Processing Incoming Jobs", NULL,
                                tmp_toolbar_icon, NULL, NULL);
  gtk_widget_set_name (toolbar_start_button, "toolbar_start_button");
 
================================

 the GTK docs says that "Start" will be used to create the label, but it does
not name the label widget itself.

  I tried calling gtk_object_get_data(toolbar_start_button, "Start"); 
  to see if GTK had "named" the widget under the hood, but it fails.

 Any other approach?


--- Luciano Chavez <lnx1138 us ibm com> wrote:
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

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com



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