bug in FindItemForId() fixed (?)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -469,7 +469,6 @@ void wxMenu::ProcessCommand(wxCommandEvent & event)
|
|||||||
// Finds the item id matching the given string, -1 if not found.
|
// Finds the item id matching the given string, -1 if not found.
|
||||||
int wxMenu::FindItem (const wxString& itemString) const
|
int wxMenu::FindItem (const wxString& itemString) const
|
||||||
{
|
{
|
||||||
// FIXME fixed size buffer
|
|
||||||
wxString itemLabel = wxStripMenuCodes(itemString);
|
wxString itemLabel = wxStripMenuCodes(itemString);
|
||||||
for ( wxNode *node = m_menuItems.First(); node; node = node->Next() )
|
for ( wxNode *node = m_menuItems.First(); node; node = node->Next() )
|
||||||
{
|
{
|
||||||
@@ -497,7 +496,7 @@ wxMenuItem *wxMenu::FindItemForId(int itemId, wxMenu ** itemMenu) const
|
|||||||
*itemMenu = NULL;
|
*itemMenu = NULL;
|
||||||
|
|
||||||
wxMenuItem *item = NULL;
|
wxMenuItem *item = NULL;
|
||||||
for ( wxNode *node = m_menuItems.First(); node; node = node->Next() )
|
for ( wxNode *node = m_menuItems.First(); node && !item; node = node->Next() )
|
||||||
{
|
{
|
||||||
item = (wxMenuItem *)node->Data();
|
item = (wxMenuItem *)node->Data();
|
||||||
|
|
||||||
@@ -505,13 +504,15 @@ wxMenuItem *wxMenu::FindItemForId(int itemId, wxMenu ** itemMenu) const
|
|||||||
{
|
{
|
||||||
if (itemMenu)
|
if (itemMenu)
|
||||||
*itemMenu = (wxMenu *)this;
|
*itemMenu = (wxMenu *)this;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else if ( item->IsSubMenu() )
|
else if ( item->IsSubMenu() )
|
||||||
{
|
{
|
||||||
item = item->GetSubMenu()->FindItemForId(itemId, itemMenu);
|
item = item->GetSubMenu()->FindItemForId(itemId, itemMenu);
|
||||||
if ( item )
|
}
|
||||||
break;
|
else
|
||||||
|
{
|
||||||
|
// don't exit the loop
|
||||||
|
item = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user