I read through KB Article: KB02028 which shows a Sub to make the Enter key act like the Tab key when hit while in the UltraGrid. However it does not explain how to call it or when to call. Does anyone have any advice as how to implement it?
The code in this sample is modifying the grid's KeyActionMapping collection. So you can call this code from anywhere you want. It just needs to be called once, up front, to modify the grid for the lifetime of the control.
So the Form_Load event it a good place to call this method and you would call it once for each UltraGrid on the form.
Thanks, gave it a try and it worked like a charm. However I called it from the Grid's InitializeLayout event putting it with other initializing stuff.
InitializeLayout will probably work for most application, but you have to be careful, because InitializeLayout may get called more than once.
It gets called any time you set the grid's DataSource/DataMember and it may also fire when you load a layout or get a Reset notification from the data source - although I'm not 100% sure about those two cases.
So if the event gets called a second time, you might end up adding in the mappings twice and the Enter key will start tabbing two cells instead of one.
Thank for the pointer. I will keep that in mind when working on this form.
Sorry to resurrect an old one but I'm getting weird results.
I applied this to an existing grid - cell(0) and cell(1) are a date datatype/date time editor. When I add a row, I seed those two cells with a datetime value and put the user in cell(1) in edit mode with the text selected (so they just start typing to replace it).
When they press the enter key to leave the cell, instead of moving to cell(2) as the tab key would do, the Enter key moves DOWN a cell, adding a new row but leaving fields empty in the previous row.
Any idea where I might look to track down the source of this issue?
Is it potentially related to having configured shortcuts on menu items that map to Ctrl-Tab?