newntui/activex/groupscombo/src/groupscomboctl.cpp
//-------------------------------------------------------------------------------------
// Callabck runs every time the element editing process is ended.
// will not allow to change the group name to the empty one or to use the existing 
// group name.
//-------------------------------------------------------------------------------------
Callabck runs every time the element editing process is ended.
will not allow to change the group name to the empty one or to use the existing
group name.
Callabck runs every time the element editing process is ended . will not allow to change the group name to the empty one or to use the existing group name .
void CGroupsComboCtrl::OnItemEditEnd(NMHDR* pNMHDR, LRESULT* pResult) {
LV_DISPINFO* info = (LV_DISPINFO *) pNMHDR;
CString newName;
CString serverCall;
CString serverResults;
   if(info->item.pszText==NULL) return;
   newName="";
   for(register unsigned i=0;i<strlen(info->item.pszText);i++) {
      if( info->item.pszText[i] != '{' && 
		  info->item.pszText[i]!= '}' && 
		  info->item.pszText[i]!= ' ')  {
	           newName+=info->item.pszText[i];
	  } else {
	           newName+='_';
	  }
   }   
   serverCall.Format("group exists %s",newName);
   EvaluateSync(serverCall,&serverResults);
   if(atoi(serverResults)!=0) {
      CString errStr;
	  errStr.Format("The group with the name \"%s\" already exists!",newName);
	  MessageBox(errStr,"Group Manager Error",MB_ICONSTOP);
	  m_ElementsList.SetItemText(info->item.iItem,info->item.iSubItem,oldLabel);
	  return;
   }
   serverCall.Format("group rename %s %s",oldLabel,newName);
   EvaluateSync(serverCall,&serverResults);
   m_ElementsList.SetItemText(info->item.iItem,info->item.iSubItem,newName);
   FireGroupRenamed(newName);
}
void CGroupsComboCtrl :: OnItemEditEnd ( NMHDR * pNMHDR , LRESULT * pResult ) { LV_DISPINFO * info = ( LV_DISPINFO * ) pNMHDR ; CString newName ; CString serverCall ; CString serverResults ; if ( info -> item . pszText == NULL ) return ; newName = " " ; for ( register unsigned i = 0 ; i < strlen ( info -> item . pszText ) ; i ++ ) { if ( info -> item . pszText [ i ] != ' ' && info -> item . pszText [ i ] != ' ' && info -> item . pszText [ i ] != ' ' ) { newName += info -> item . pszText [ i ] ; } else { newName += ' ' ; } } serverCall . Format ( " " , newName ) ; EvaluateSync ( serverCall , & serverResults ) ; if ( atoi ( serverResults ) != 0 ) { CString errStr ; errStr . Format ( " \" \" " , newName ) ; MessageBox ( errStr , " " , MB_ICONSTOP ) ; m_ElementsList . SetItemText ( info -> item . iItem , info -> item . iSubItem , oldLabel ) ; return ; } serverCall . Format ( " " , oldLabel , newName ) ; EvaluateSync ( serverCall , & serverResults ) ; m_ElementsList . SetItemText ( info -> item . iItem , info -> item . iSubItem , newName ) ; FireGroupRenamed ( newName ) ; }
Callabck runs every time the element editing process is ended.
Callabck runs every time the element editing process is ended .
// Operation cancelled.  // Removing "{" "}" and spaces from the new name; // Maybe we are trying to create existing group ?   