newntui/activex/groupscombo/src/groupscomboctl.cpp
//-------------------------------------------------------------------------------------
// Enables or disables toolbar buttons according to the current selection and current
// elements amount.
//-------------------------------------------------------------------------------------
Enables or disables toolbar buttons according to the current selection and current
elements amount.
Enables or disables toolbar buttons according to the current selection and current elements amount .
void CGroupsComboCtrl::SetToolbarStatus(void) {
    if(m_ControlsEnable==FALSE) return;
	if(m_ElementsList.GetItemCount()==0) {
		m_OpTools.EnableButton(IDB_ALL,            FALSE);
		m_OpTools.EnableButton(IDB_DIFF,           FALSE);
		m_OpTools.EnableButton(IDB_INTERSECT,      FALSE);
		m_OpTools.EnableButton(IDB_REMOVEGROUP,    FALSE);
		m_OpTools.EnableButton(IDB_INSERTSEL,      FALSE);
		m_OpTools.EnableButton(IDB_REMOVESEL,      FALSE);
		m_OpTools.EnableButton(IDB_FINDFIRSTGROUP, FALSE);
		m_OpTools.EnableButton(IDB_FINDNEXTGROUP,  FALSE);
	} else {
		if(m_ElementsList.GetSelectedCount()>1) {
		   m_OpTools.EnableButton(IDB_DIFF,     TRUE);
		   m_OpTools.EnableButton(IDB_INTERSECT,TRUE);
		} else {
		   m_OpTools.EnableButton(IDB_DIFF,     FALSE);
		   m_OpTools.CheckButton(IDB_ALL);
		   if(m_ElementsList.GetSelectedCount()==0) {
		      m_OpTools.EnableButton(IDB_REMOVEGROUP, FALSE);
		      m_OpTools.EnableButton(IDB_REMOVESEL,   FALSE);
	          m_OpTools.EnableButton(IDB_INSERTSEL,   FALSE);
		   } else {
		      m_OpTools.EnableButton(IDB_REMOVEGROUP, TRUE);
		      m_OpTools.EnableButton(IDB_REMOVESEL,   TRUE);
	          m_OpTools.EnableButton(IDB_INSERTSEL,   TRUE);
		   }
		}
		m_OpTools.EnableButton(IDB_ALL,         TRUE);
		m_OpTools.EnableButton(IDB_INSERTSEL,   TRUE);
		m_OpTools.EnableButton(IDB_FINDFIRSTGROUP, TRUE);
		if(m_Search.GetLength()>0)
		    m_OpTools.EnableButton(IDB_FINDNEXTGROUP,  TRUE);
	    else
		    m_OpTools.EnableButton(IDB_FINDNEXTGROUP,  FALSE);
	}
	m_OpTools.EnableButton(IDB_NEWGROUP,TRUE);
}
void CGroupsComboCtrl :: SetToolbarStatus ( void ) { if ( m_ControlsEnable == FALSE ) return ; if ( m_ElementsList . GetItemCount ( ) == 0 ) { m_OpTools . EnableButton ( IDB_ALL , FALSE ) ; m_OpTools . EnableButton ( IDB_DIFF , FALSE ) ; m_OpTools . EnableButton ( IDB_INTERSECT , FALSE ) ; m_OpTools . EnableButton ( IDB_REMOVEGROUP , FALSE ) ; m_OpTools . EnableButton ( IDB_INSERTSEL , FALSE ) ; m_OpTools . EnableButton ( IDB_REMOVESEL , FALSE ) ; m_OpTools . EnableButton ( IDB_FINDFIRSTGROUP , FALSE ) ; m_OpTools . EnableButton ( IDB_FINDNEXTGROUP , FALSE ) ; } else { if ( m_ElementsList . GetSelectedCount ( ) > 1 ) { m_OpTools . EnableButton ( IDB_DIFF , TRUE ) ; m_OpTools . EnableButton ( IDB_INTERSECT , TRUE ) ; } else { m_OpTools . EnableButton ( IDB_DIFF , FALSE ) ; m_OpTools . CheckButton ( IDB_ALL ) ; if ( m_ElementsList . GetSelectedCount ( ) == 0 ) { m_OpTools . EnableButton ( IDB_REMOVEGROUP , FALSE ) ; m_OpTools . EnableButton ( IDB_REMOVESEL , FALSE ) ; m_OpTools . EnableButton ( IDB_INSERTSEL , FALSE ) ; } else { m_OpTools . EnableButton ( IDB_REMOVEGROUP , TRUE ) ; m_OpTools . EnableButton ( IDB_REMOVESEL , TRUE ) ; m_OpTools . EnableButton ( IDB_INSERTSEL , TRUE ) ; } } m_OpTools . EnableButton ( IDB_ALL , TRUE ) ; m_OpTools . EnableButton ( IDB_INSERTSEL , TRUE ) ; m_OpTools . EnableButton ( IDB_FINDFIRSTGROUP , TRUE ) ; if ( m_Search . GetLength ( ) > 0 ) m_OpTools . EnableButton ( IDB_FINDNEXTGROUP , TRUE ) ; else m_OpTools . EnableButton ( IDB_FINDNEXTGROUP , FALSE ) ; } m_OpTools . EnableButton ( IDB_NEWGROUP , TRUE ) ; }
Enables or disables toolbar buttons according to the current selection and current
elements amount.
Enables or disables toolbar buttons according to the current selection and current elements amount .