Re: gtk-list digest, Vol 1 #1659 - 12 msgs
- From: Peter Krueger <pkrueger appss de>
- To: gtk-list gnome org
- Cc: "J. Davison de St. Germain" <dav sci utah edu>
- Subject: Re: gtk-list digest, Vol 1 #1659 - 12 msgs
- Date: Thu, 28 Aug 2003 15:42:15 +0200 (MEST)
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 berezniker com>
> To: "J. Davison de St. Germain" <dav sci utah edu>
> Cc: gtk-list gnome org
> 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 appss de
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.
====================================================================
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]