Re: [gtkmm] Renaming a menu item



Guess, that shall help (see below).

Andreas B. Thun wrote:

Dear list members,

I have a Pulldown Menu with some list items.
I cannot figure out how to rename (change label name)
of a specific item
.
Can some body help?



 MenuList& ml = m_dataBase_menu->items();

 int i = 0;
 MenuList::iterator itr_ml;
 for (itr_ml = ml.begin(); itr_ml != ml.end(); ++itr_ml) {
if (i == itemNr)
       Gtk::MenuItem* item =
           dynamic_cast<Gtk::MenuItem *>( &*m_it );
       if (item == 0) // something wrong
           continue;

       Gtk::Label *lab = dynamic_cast<Gtk::Label*>( item->get_child() );
       if ( lab )
           lab->set_text( <new string> );

	  // want change the name of itr_ml (menu item)
	i++;
 }





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