Re: Removing a menuitem from a menu?




"Michael" <mikejuni@yahoo.com> writes:

> How?
> 
> Using gtk_container_remove()? Is that the right choice?

Yes, gtk_container_remove() will work. However, unless you
want to use the widgets later, it's a little more efficient
and safer to just destroy the menuitem, which will automatically
remove it from its parent. 

> How about if I want to remove all the menuitems from a menu, but I don't
> have
> pointers to the menuitems, except the one kept in the menu.

 gtk_container_foreach (GTK_CONTAINER (menu), (GtkCallback)gtk_widget_destroy, NULL);

> I think gtk should implement those functions like
> gtk_menu_remove(GtkMenu* menu, GtkWidget* menuitem);

What advantage would this have over gtk_container_remove()?

It could be argued that gtk_container_remove() really should
be implemented as gtk_widget_remove_from_parent() since the container
argument to gtk_container_remove() is superfluous, but I
see no advantage to having per-container-type remove functions.

Regards,
                                        Owen



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