[gtkmm] Removing a menu entry



Hi list members, 

I have written a method to remove a menu item with
a specific number in my menu that does not work well.

Let's say I want to remove #2 in this menu list:
entry1
entry2
entry3

After remove I get this in my menu:
entry1
------
entry3

How can I get rid of item #2 (separator line)?

I want:
entry1
entry3


void TopMenuBar::removeDataBaseMenu(const int& itemNr)
{
  cout << "      removing #" << itemNr << endl;

  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) 
	  itr_ml->remove(); // it removes the menu item but I get a line then!
	i++;
  }
  glTabCnt--;

} // removeDataBaseMenu()



TIA,
Andi



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