Hi, currently the cell editing behavior seems to allow a user to add a newline as the cell text content by press "Shift-Enter".
Now our users complain, that they want a MS Access like behavior, where they use a "Ctrl-Enter" to get a newline in the cell text.My question: how can I get this behavior within UltraGrid, that is bound to a DataTable?If possible, I like to know a solution for IG 2007.3, but at least for the newest release there should be a solution... -or not?
Thanks for the response. Catching the key events on the grid will not help: it does NOT receive them from within an open embedded editor.
But we recently found the reason it did not worked as expected (and fixed that): we used special key mappings to get required key navigation behavior using this lines of code:// Enter: in edit mode will move the selection down to cell belowthis.grid.KeyActionMappings.Add(new GridKeyActionMapping(Keys.Enter, UltraGridAction.BelowCell, UltraGridState.RowLast, UltraGridState.InEdit, SpecialKeys.Alt | SpecialKeys.Shift, 0));
// Enter: if cell is selected, it will enter edit mode
this.grid.KeyActionMappings.Add(new GridKeyActionMapping(Keys.Enter, UltraGridAction.ToggleEditMode,UltraGridState.InEdit, UltraGridState.Cell,SpecialKeys.Alt, 0));
As you can see: we did not take the "Ctrl" special key into account. If we do so, it works also with Ctrl-Enter to advance a newline.
Thanks!
When a normal text cell in the grid goes into edit mode,the grid displays a DotNet TextBox control to allow editing. So it's this control that is responding to the keys. My guess is that you would have to trap the KeyDown of the grid and modify the contents of the cell yourself or maybe access the TextBox control and set it's SelectedText. You can get to the TextBox by using grid.Controls[0] - assuming a cell is in edit mode.