|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
How to remove MenuItem from Menu?There are several functions to dynamically change/reorder menus,
but I couldn't find or figure out a way how to remove a certain item from a Menu. Is this possible? How? (I tried some strange things like calling item->destroy and was not surprised that it didn't work ...) Regards, Peter _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@... http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list |
|
|
Re: How to remove MenuItem from Menu?2009/10/21 Peter Daum <gator_ml@...>:
> There are several functions to dynamically change/reorder menus, > but I couldn't find or figure out a way how to remove a certain > item from a Menu. Is this possible? How? > > (I tried some strange things like calling item->destroy > and was not surprised that it didn't work ...) You can just use gtk_widget_destroy(item), I believe. Though I generally just destroy and rebuild the whole menu for safety. John _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@... http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list |
|
|
Re: How to remove MenuItem from Menu?On Wed, 21 Oct 2009, Peter Daum wrote: > There are several functions to dynamically change/reorder menus, > but I couldn't find or figure out a way how to remove a certain > item from a Menu. Is this possible? How? > > (I tried some strange things like calling item->destroy > and was not surprised that it didn't work ...) You might want to consider making an item inactive rather than removing it -- depending on the context, of course. I think it's typically more user-friendly, or user-informative, to make an inapplicable menu item inactive. If the item is not there, the user may wonder, "Huh, can't this program do X?", but if it's there and inactive the user may realize, "Yes, it can do X, but there's something about the current state that makes X unavailable." Anyway, if a menu item represents a GtkAction, it can be made inactive via gtk_action_set_sensitive(). Allin Cottrell _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@... http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list |
|
|
Re: How to remove MenuItem from Menu?jcupitt@... wrote: > 2009/10/21 Peter Daum <gator_ml@...>: >> (I tried some strange things like calling item->destroy >> and was not surprised that it didn't work ...) > > You can just use gtk_widget_destroy(item), I believe. Though I > generally just destroy and rebuild the whole menu for safety. oops - when I tried it with destroy, I had screwed up; I re-checked it, and this time it works :-) Thanks, Peter _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@... http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list |
|
|
Re: How to remove MenuItem from Menu?ke, 2009-10-21 kello 23:11 +0200, Peter Daum kirjoitti:
> There are several functions to dynamically change/reorder menus, > but I couldn't find or figure out a way how to remove a certain > item from a Menu. Is this possible? How? > > (I tried some strange things like calling item->destroy > and was not surprised that it didn't work ...) This should work (I do something similar for menu items added/removed by plugins when they are enabled/disabled): * when you create and add the menu item, keep a reference to it * when you remove it, call the function to remove a child from the container; with the Python binding's it's just the .remove(menuitem) method, but in C I guess it's gtk_container_remove. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@... http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list |
|
|
Re: How to remove MenuItem from Menu?2009/10/22 Lars Wirzenius <liw@...>:
> * when you create and add the menu item, keep a reference to it > > * when you remove it, call the function to remove a child from the > container; with the Python binding's it's just the .remove(menuitem) > method, but in C I guess it's gtk_container_remove. Actually, you can just search for the item and destroy it with gtk_widget_destroy(). _destroy() will automatically unlink widgets from their containers. John _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@... http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list |
| Free embeddable forum powered by Nabble | Forum Help |