Hi, i want to be able to delete the active row by pressing de delete key in the keyboard even if there is an active cell in the row (not in edit state). When you select the whole row by clicking on the row selector and then you press the delete key, the active row is deleted. But if you have an active cell and then you press the delete key nothing happens.
I've tried to add KeyActionMapping, but nothing again.
this.ultraGrid1.KeyActionMappings.Add(new GridKeyActionMapping( Keys.Delete, UltraGridAction.DeleteRows, UltraGridState.InEdit, UltraGridState.Cell | UltraGridState.Row, SpecialKeys.All, 0));
Do I have to handle the delete key in the keypress event?
Is there a keyboard way to deactivate the current cell, and let the row active?
Thnx.
I think the reason your new Mapping probably doesn't work is that there are already mappings in the collection that handle the delete key. Since you are adding yours to the bottom of the collection, the existing ones get processed first. Try Inserting your mapping to the top of the collection and see if that works.
I think that will work, but if not, you might want to try finding the existing mapping that handles the delete key and change it, rather than adding a new one. There are actually quite a few mappings that handle the delete key, but all but one of them has a StateDisallowed of Selected. So you can just search the collection for a mapping whose KeyCode is Delete and whose StateDisallowed is none.
Thanks for your answer. I've tried to set my mapping at position 0, but it doesn't work either.
I've listed all mappings and these are all the mappings for the delete key (reordered):
KeyCode;ActionCode;StateRequired;SpecialKeysRequired;StateDisallowed;SpecialKeysDisallowed
Delete;DeleteCells;CanDeleteCells;0;InEdit, SwapDroppedDown, FilterDroppedDown;AllDelete;DeleteRows;Row;0;InEdit;AllDelete;Cut;CanCut;Shift;InEdit, SwapDroppedDown, FilterDroppedDown;AltCtrlDelete;DeleteRows;Cell, Row;0;InEdit;All
and i've put an event handler in the keydown event to see what the grid state is, and when you have an active cell the state is : Cell, Row. When you select the entire row clicking on the selector the state is : Row.
Thanx.