How can I most efficiently set up a grid so that pressing enter will move focus the next row, first editable cell?
Here is a code sample that demonstrates how to add a custom key-action mapping, and how to use the PerformAction method to do what you described here. Note that this is not necessarily a robust solution to your specific problem, but rather demonstrates some of the approaches you can take.
// Add a mapping that activates the next rowthis.ultraGrid.KeyActionMappings.Add( new GridKeyActionMapping( Keys.Enter, UltraGridAction.NextRow, 0, UltraGridState.Row, SpecialKeys.All, 0) );
// Handle AfterPerformAction, and enter edit mode on the first cell// after the 'NextRow' action is performed.AfterUltraGridPerformActionEventHandler handler =delegate( object sender, AfterUltraGridPerformActionEventArgs args ){ if ( args.UltraGridAction == UltraGridAction.NextRow ) { this.ultraGrid.ActiveRow.Cells[0].Activate(); this.ultraGrid.PerformAction(UltraGridAction.EnterEditMode); }};
this.ultraGrid.AfterPerformAction += handler;
Instead of using
this.ultraGrid.ActiveRow.Cells[0].Activate(); this.ultraGrid.PerformAction(UltraGridAction.EnterEditMode);
I have hidden and rearranged columns. How do I ensure placement into the first visible, editable cell?
This gets me the desired NextRow action. Now I need to enter edit mode on the first editable cell, excluding binary fields.