void CDocSelector::OnTimer(UINT nIDEvent) { for ( int i = 0; i < m_Buttons.GetSize(); i++ ) { CSwitcherButton* wndButton = (CSwitcherButton *) m_Buttons.GetAt( i ); // May be the user has destroyed the view... if ( wndButton->m_AttachedView ) { if ( GetFocus() == wndButton->m_AttachedView ) { if ( wndButton->m_nState != SWITCHBUTTON_SELECTED ) { wndButton->Select(); m_iSelectedButton = i; } } else { if ( wndButton->m_nState == SWITCHBUTTON_SELECTED ) wndButton->Unselect(); } } // Yes, he has, critical condition..., break... else break; } CControlBar::OnTimer(nIDEvent); }
void CDocSelector::OnTimer(UINT nIDEvent) { for ( int i = 0; i < m_Buttons.GetSize(); i++ ) { CSwitcherButton* wndButton = (CSwitcherButton *) m_Buttons.GetAt( i ); // May be the user has destroyed the view... if ( wndButton->m_AttachedView ) { // Modified by Bender to fix akward problem with CFormView and GetFocus() // MFC works in misterious ways ;) if(GetApp()->GetMainFrame()->MDIGetActive() == wndButton->m_AttachedView->GetParentFrame()) //if ( GetFocus() == wndButton->m_AttachedView) { if ( wndButton->m_nState != SWITCHBUTTON_SELECTED ) { wndButton->Select(); m_iSelectedButton = i; } } else { if ( wndButton->m_nState == SWITCHBUTTON_SELECTED ) wndButton->Unselect(); } } // Yes, he has, critical condition..., break... else break; } CControlBar::OnTimer(nIDEvent); }