Re: [gtkmm] Question to removal of MenuItems



Maybe somebody can help me out with building the loop?
Mine does not seem to be correct:

void TopMenuBar::removeDataBaseMenu(const int& itemNr)
{
  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();
  }

  glTabCnt--;

} // removeDataBaseMenu()


On Thu, Feb 12, 2004 at 05:23:01PM +0100, Andreas B. Thun wrote:

I donīt know. I havenīt found any docu to erase().

*itr_ml.erase() does not compile, anyway.

I donīt even know if my loop is ok and if
*itr_ml represents a MenuItem.
All I want to do is to delete MenuItem #itemNr
from the MenuBar.



void TopMenuBar::removeDataBaseMenu(const int& itemNr)
{
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(); // there is no remove or erase. How can I remove

    ^^^^^^^^^^^^^^^^

Wouldn't that rather be ml.erase (itr_ml);?




	  the item?
	i++;
}

glTabCnt--;

} // removeDataBaseMenu()









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