Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Deleting more than one selected records in ArrayCtrl 
	
		
		
			| Deleting more than one selected records in ArrayCtrl [message #14700] | 
			Sun, 09 March 2008 19:40   | 
		 
		
			
				
				
				
					
						  
						zsolt
						 Messages: 702 Registered: December 2005  Location: Budapest, Hungary
						
					 | 
					Contributor   | 
					 | 
		 
		 
	 | 
 
	
		In current implementation (last beta), if user selects more than one rows (in multiselect mode), "Delete row" deletes only one of the selected rows. 
I would change this code from 
bool ArrayCtrl::DoRemove()
{
	if(IsReadOnly()) return false;
	if(!IsCursor() || askremove && !PromptOKCancel(RowFormat(t_("Do you really want to delete the selected %s ?"))))
		return false;
	Remove(cursor);
	WhenArrayAction();
	return true;
}
 
to 
bool ArrayCtrl::DoRemove()
{
	if(IsReadOnly()) return false;
	if(!IsCursor() || askremove && !PromptOKCancel(RowFormat(t_("Do you really want to delete the selected %s ?"))))
		return false;
	if(multiselect) {
		for(int i=GetCount()-1; i>=0; i--){
			if(IsSelected(i)){
				Remove(i);
			}
		}
	}
	else
		Remove(cursor);
	WhenArrayAction();
	return true;
}
 
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 02:18:27 CET 2025 
 Total time taken to generate the page: 0.04849 seconds 
 |