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 03:13 PM

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 01:17 PM

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 02:13 PM

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 02:49 PM

WantEscapeKey works great! Thanks!!!


VA Vladimir Arkhipov October 8, 2003 02:49 PM

WantEscapeKey works great! Thanks!!!


VA Vladimir Arkhipov October 10, 2003 06:35 AM

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 07:41 AM

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