コード例 #1
0
ファイル: DocSelect.cpp プロジェクト: open2cerp/Open2C-ERP
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);
}
コード例 #2
0
ファイル: DocSelect.cpp プロジェクト: MXControl/RoboMX
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);
}