Re: gtk-list digest, Vol 1 #1659 - 12 msgs

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

 



Hi,
when the menu item already contains a GtkLabel, e.g. when you created it
with:

  GtkWidget *pItem = gtk_menu_item_new_with_label("Turn On Light");

then you can also change it directly with:

  gtk_label_set_text(GTK_LABEL(gtk_bin_get_child(GTK_BIN(pItem))),
    "Turn Off Light");

I think there is no function like gtk_menu_item_set_label() because a
GtkLabel inside a menu item is only a (very common) special case. If you
like you can also put a GtkHBox containing an image and text or anything
else you want inside a menu item. In such cases a *_set_label() function
would make no sense.

Regards...Peter

> Date: Wed, 27 Aug 2003 15:01:42 -0400
> From: Vadim Berezniker <vadim@xxxxxxxxxxxxxx>
> To: "J. Davison de St. Germain" <dav@xxxxxxxxxxxx>
> Cc: gtk-list@xxxxxxxxx
> Subject: Re: How to change the text on a menu?
>
> J. Davison de St. Germain wrote:
> > Hi,
> >
> >   Can someone please tell me how to change the text on a menu?
> > For example, if I created the menu with "Turn On Light" and
> > someone selects it, I wish to change the text to "Turn Off Light".
> > I would have expected to call gtk_menu_item_set_label() or some
> > such, but I can't find such a function.
> >
>
> I believe GtkMenuItem is a container...
>
> You need to remove the old child using gtk_container_remove and then add
> the new label using gtk_container_add.
-- 
====================================================================
Peter Krüger

applied software solutions (appss) GmbH
Sandtorstr. 23
D-39106 Magdeburg
Germany

Phone:  +49-(0)391-54486-19388
Fax:    +49-(0)391-54486-19222
email:  krueger@xxxxxxxx
URL:    http://www.appss.de

Managing Director: Uwe Hess, Dietmar Schäfer
Register: HRB12386, AG Mageburg

"Virtual business becomes reality!"

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
====================================================================

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux