Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Delete doesn't work with multiple selection (Read 3937 times)
tswords
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Dec 7th, 2005
Delete doesn't work with multiple selection
Dec 7th, 2005 at 4:23pm
Print Post  
When the user hits the DEL key with 2 or more boxes in the selection, only the single most recently selected box is deleted.  Is there a way to delete all boxes in the selection when the DEL key is pressed?

Thanks - Tim
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Delete doesn't work with multiple selection
Reply #1 - Dec 7th, 2005 at 4:30pm
Print Post  
The Del key only deletes the 'active' item, that's the one whose selection handles are white. There isn't an easy way to override that. You could try handling Del yourself using the KeyDown event. There delete all selected items in a loop, kind of:

void fc_KeyDown(...)
{
while (fc.Selection.Objects.Count > 0)
  fc.DeleteObject(fc.Selection.Objects[0]);
}

Stoyan
  
Back to top
 
IP Logged
 
tswords
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Dec 7th, 2005
Re: Delete doesn't work with multiple selection
Reply #2 - Dec 7th, 2005 at 5:55pm
Print Post  
Thanks - that worked just fine.   Just wanted to make sure I wasn't ovelooking something.
  
Back to top
 
IP Logged
 
chinlean
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: Jan 17th, 2007
Re: Delete doesn't work with multiple selection
Reply #3 - Jan 23rd, 2007 at 5:20am
Print Post  
but with this method, the fc_BoxDeleting event is not fired, right? Do we have other ways to accomplish this?


while (fc.Selection.Objects.Count > 0)
fc.DeleteObject(fc.Selection.Objects[0]);

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Delete doesn't work with multiple selection
Reply #4 - Jan 23rd, 2007 at 5:36am
Print Post  
BoxDeleting is a validation event raised when the user tries to delete a box using the Del key. By handling the event you can prevent the operation. BoxDeleted should be raised both when users delete items and when you do it via the DeleteObject method.

Stoyan
  
Back to top
 
IP Logged
 
chinlean
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: Jan 17th, 2007
Re: Delete doesn't work with multiple selection
Reply #5 - Jan 23rd, 2007 at 10:48am
Print Post  
Is there any way or workaround to delete multiple boxes by using Del key yet calling box_Deleting handler of each box?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Delete doesn't work with multiple selection
Reply #6 - Jan 23rd, 2007 at 1:37pm
Print Post  
You could call fc_BoxDeleting yourself, or just move your code from there to the loop where you call DeleteObject.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint