We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Selection behavior

Hi, I have 2 questions: 1. SelectionMode.One I press Esc button -> selection disappeared. Is it possible to have a persistent selection? 2. SelectionMode.One I press Delete button -> data disappeared from the whole row. Is it possible to make changes to current cell only? Vladimir

7 Replies

AD Administrator Syncfusion Team October 7, 2003 07:13 PM UTC

1. One idea would be to handle KeyDown and KeyUp and set a flag if Escape is pressed and reset it in KeyUp. You can then handle the selectionChanging event and set e.Cancel = true if Escape was pressed. 2. Again handle KeyDown, KeyUp, set flag and then in ClearingCells set e.Handled = true. Stefan


VA Vladimir Arkhipov October 8, 2003 05:17 PM UTC

Thank you (50%) 2. ClearingCells works!, I just added code like this: if(e.RangeList.ActiveRange.IsRows) { e.Handled = true; } 1. SelectionChanging event is not fired on Esc button press, selection just silently disappeared:(. Vladimir


AD Administrator Syncfusion Team October 8, 2003 06:13 PM UTC

I will have to look into why SelectionChanging is not raised for Escape key. Will probably need to make some code changes in the grid sources for that. But, try a) set grid.WantEscapeKey = false - or - b) override OnKeyDown and CurrentCellKeyDown and check for Keys.Escape and don't call base class version and set e.Handled = true Does that help? Stefan


VA Vladimir Arkhipov October 8, 2003 06:49 PM UTC

WantEscapeKey works great! Thanks!!!


VA Vladimir Arkhipov October 8, 2003 06:49 PM UTC

WantEscapeKey works great! Thanks!!!


VA Vladimir Arkhipov October 10, 2003 10:35 AM UTC

There is though one problem with WantEscapeKey = false. It works fine for standard text boxes, but if my cell have an image in it then "WantEscapeKey = false" resulted in blocking escape functionality. So if I am in edit mode Esc press restores initial values for standard text box and do nothing for text box with ImageIndex >= 0. Is it possible to fix it? Vladimir


AD Administrator Syncfusion Team October 10, 2003 11:41 AM UTC

Can you handle the CurrentCellKeyDown event and add necessary code for what you want to with the Escape key? (e.g. call CurrentCell.RejectChanges) Stefan

Loader.
Live Chat Icon For mobile
Up arrow icon