Hello,
I am using a UltrWinGrid and I am having trouble with the cells in the Grid.
If I use arrow keys to navigate the cells. For some reason when I press any of the arrow keys the cell focus moves from right to left. Even if I press the down or up arrow key the behavior is to move from right to left across the screen. Once the row is completed then the focus shifts to the cells in the next row below I am not sure what is happening.
Other thing I noticed was that when I click on a cell in a row which is not editable and press the backspace the whole row turns Grey. Not sure why this is happening either.
Hoping for some help as i am still learning how to use UltraWinGrid and its functions.
Thanks,Ashwin
Hi Ashwin,
Well, if the KeyDown event is not firing just for those keys, but the active cell in the grid is changing, then it seems like the grid must be handling those keys before the KeyDown event gets called somehow and then the grid is not firing the event.
That should not happen. The grid should fire the KeyDown event and give you a chance to handle the key first. But without knowing all of the grid's property settings and the current state of the grid when this is occurring, it's impossible for me to try this out to see if it's a bug.
What version of the grid are you using?
Can you post a small sample project demonstrating this behavior?
Hello Mike,
I hook the event here
public StoreTransferView()
{
InitializeComponent();
this.dgItems.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dgItems_KeyDown);
}
I have attached and image of how and where the grid appears. ( Its in the middle below the "Add Items" Drop down button)
I also noticed that the event handler fires for any other key on the key board except for the arrow keys. And when I press the arrow key, although the event handler does not get called the selection moves from left to right.
Hoping for some help / suggestions
Thanks,
Ashwin
Hi,
If the event is not firing (Debug mode or otherwise), then something is wrong. Are you sure you are hooking the event? Is it getting unhooked somewhere else in your code? Is there a toolbar or something on the form that might be eating the arrow keys?
I have this code for tracking the key press event but for some reason it does not even get to this code when I run it in Debug mode
switch (e.KeyCode)
case Keys.Up:
dgItems.PerformAction(UltraGridAction.ExitEditMode, false, false);
int saveActiveCellIndex = dgItems.ActiveCell.Column.Index;
if (dgItems.ActiveRow.Index > 0)
dgItems.ActiveRow = dgItems.Rows[dgItems.ActiveRow.Index - 1];
dgItems.ActiveCell = dgItems.ActiveRow.Cells[saveActiveCellIndex];
e.Handled = true;
dgItems.PerformAction(UltraGridAction.EnterEditMode, false, false);
break;
case Keys.Down:
int saveActiveCellIndexs = dgItems.ActiveCell.Column.Index;
if (dgItems.ActiveRow.Index < dgItems.Rows.Count - 1)
dgItems.ActiveRow = dgItems.Rows[dgItems.ActiveRow.Index + 1];
dgItems.ActiveCell = dgItems.ActiveRow.Cells[saveActiveCellIndexs];
case Keys.Left:
dgItems.PerformAction(UltraGridAction.PrevCell, false, false);
case Keys.Right:
dgItems.PerformAction(UltraGridAction.NextCell, false, false);