newntui/activex/groupscombo/src/groupscomboctl.cpp
//------------------------------------------------------------------------------------
// Will remove all selected groups. Will ask to confirm the removing if there are 
// multiple groups selected.
// Will fire RemoveGroups event with the removed groups counter as a  parameter.
//------------------------------------------------------------------------------------
Will remove all selected groups. Will ask to confirm the removing if there are
multiple groups selected.
Will fire RemoveGroups event with the removed groups counter as a  parameter.
Will remove all selected groups . Will ask to confirm the removing if there are multiple groups selected . Will fire RemoveGroups event with the removed groups counter as a parameter .
void CGroupsComboCtrl::OnRemoveGroup() {
int selectionsAmount;
   selectionsAmount= m_ElementsList.GetSelectedCount();
    if(selectionsAmount==0) {
	   MessageBox("No groups selected to remove!","Group Manager Error",MB_ICONSTOP);
	   return;
	} 
	if(selectionsAmount>1) {
	   CString prompt;
	   prompt.Format("You are going to remove %d groups\nAre you shure?",selectionsAmount);
	   if(MessageBox(prompt,"Group Manager Warning",MB_YESNO | MB_ICONQUESTION)==IDNO)
		   return;
	}
	for(register i=m_ElementsList.GetItemCount()-1; i>=0; i--) {
		if(m_ElementsList.GetItemState(i,LVIS_SELECTED)!=0) {
			CString serverRequest;
			serverRequest.Format("group delete %s",m_ElementsList.GetItemText(i,0));
			m_ElementsList.DeleteItem(i);
			EvaluateSync(serverRequest);
		}
	}
	SetToolbarStatus();
	if(m_ElementsList.GetSelectedCount()>0) FillElementsList();
    m_GroupsList="";
	for(i=0; i<m_ElementsList.GetItemCount();i++) {
       if(m_ElementsList.GetItemState(i,LVIS_SELECTED)!=0) {
		  m_GroupsList+="{";
		  m_GroupsList+=m_ElementsList.GetItemText(i,0);
		  m_GroupsList+='}';
		}
	}
	FillElementsList();
	FireGroupRemoved(selectionsAmount);
}
void CGroupsComboCtrl :: OnRemoveGroup ( ) { int selectionsAmount ; selectionsAmount = m_ElementsList . GetSelectedCount ( ) ; if ( selectionsAmount == 0 ) { MessageBox ( " " , " " , MB_ICONSTOP ) ; return ; } if ( selectionsAmount > 1 ) { CString prompt ; prompt . Format ( " \n " , selectionsAmount ) ; if ( MessageBox ( prompt , " " , MB_YESNO | MB_ICONQUESTION ) == IDNO ) return ; } for ( register i = m_ElementsList . GetItemCount ( ) - 1 ; i >= 0 ; i -- ) { if ( m_ElementsList . GetItemState ( i , LVIS_SELECTED ) != 0 ) { CString serverRequest ; serverRequest . Format ( " " , m_ElementsList . GetItemText ( i , 0 ) ) ; m_ElementsList . DeleteItem ( i ) ; EvaluateSync ( serverRequest ) ; } } SetToolbarStatus ( ) ; if ( m_ElementsList . GetSelectedCount ( ) > 0 ) FillElementsList ( ) ; m_GroupsList = " " ; for ( i = 0 ; i < m_ElementsList . GetItemCount ( ) ; i ++ ) { if ( m_ElementsList . GetItemState ( i , LVIS_SELECTED ) != 0 ) { m_GroupsList += " " ; m_GroupsList += m_ElementsList . GetItemText ( i , 0 ) ; m_GroupsList += ' ' ; } } FillElementsList ( ) ; FireGroupRemoved ( selectionsAmount ) ; }
Will remove all selected groups.
Will remove all selected groups .