Re: how can i retrieve a submenu item to set it non sensitive??



Hmmz, i do the same (sort of) somewhere in gparted, it looks like :
( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 1 ] .get_submenu( )
->items( ) [ 0 ] ) ->set_sensitive( b ) ;

so it can be done as a one-liner :)
see also:
http://cvs.gnome.org/viewcvs/gparted/include/Win_GParted.h?rev=1.26&view=markup

plors

On Thu, 2005-12-22 at 15:36 +0100, N poleone wrote:
> Hi,
> I've a menu bar with three menu (File, Edit, Information), all with submenus.
> I want to retrieve a menuItem of the Edit menu to change the sensitive
> state at runtime...
> The menubar is public.
> This is what i'm trying:
> 	Gtk::Menu_Helpers::MenuList::iterator it_menu;
> 	Gtk::Menu_Helpers::MenuList& ml = this->menubar1->items();
> 	for (it_menu=ml.begin(); it_menu!=ml.end(); ++it_menu) {
> // in this way i got one of the three menus, right?????
> Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem *>(&*it_menu);
> 			if (item==0)
> 				continue;
> 			else {
> // why this print "gtk__MenuItem", and not the name of the item???
> 				std::cout<<item->get_name()<<"\n";
> 			}
> 	}
> 
> How can I retrive an item in the submenu??? is it possible with the
> name (string)????
> 
> --
> Ciao da
> N poleone (ICQ# 266220356; MSN Messenger: napoleone1981 yahoo it)
> "Le battaglie si vincono con gli uomini che si hanno, non con quelli che
> si vorrebbero" (Napoleone Bonaparte)
> "Le cose che possiedi prima o poi ti possiedono..." (Fight Club)
> "Le donne possono avere bambini...gli uomini computers" (Anonimo)
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list




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