// window will be used.
void wxMenuBase::UpdateUI(wxEvtHandler* source)
{
- if (GetInvokingWindow())
- {
- // Don't update menus if the parent
- // frame is about to get deleted
- wxWindow *tlw = wxGetTopLevelParent( GetInvokingWindow() );
- if (tlw && wxPendingDelete.Member(tlw))
- return;
- }
+ wxWindow * const win = GetWindow();
- if ( !source && GetInvokingWindow() )
- source = GetInvokingWindow()->GetEventHandler();
+ if ( !source && win )
+ source = win->GetEventHandler();
if ( !source )
source = GetEventHandler();
if ( !source )
{
wxWindowID itemid = item->GetId();
wxUpdateUIEvent event(itemid);
- event.SetEventObject( source );
+ event.SetEventObject( this );
if ( source->ProcessEvent(event) )
{
void wxMenuBarBase::UpdateMenus()
{
- wxEvtHandler* source;
wxMenu* menu;
int nCount = GetMenuCount();
for (int n = 0; n < nCount; n++)
{
menu = GetMenu( n );
if (menu != NULL)
- {
- source = menu->GetEventHandler();
- if (source != NULL)
- menu->UpdateUI( source );
- }
+ menu->UpdateUI( NULL );
}
}