Hi all,
I have a new task that need to display out a report in grid with few column of data, then allow user direct fill in the data like using excel. the grid should be able to move to next cell by clicking the arrow keys in keyboard, and user can direct key-in the value. May I know is it any function of infragistic able to customize like this?
Please guide.
Thank you very much!
Hi,
This KB article should help you achieve what you want with the arrow keys:
HOWTO:UltraWinGrid Cursor Movement like Excel
Hi Mike,
Thanks for your useful information. Currently my project is written in C#, so I guess it will be very helpful that if you can provide me any sample available in C#.
Hello!!!!
I have this exact piece of code for just my up and down arrows.... but the focus moves to left or right!! I tried what somebody else said - do scroll below -- but if you have filters on, then there are issues with this piece of code...Kinda started working on fixing it. What am I missing which is not making the cursor move up and down but left and right? Using Infragistics v.12.1...
THANKSChitra
ultraGridForecast.PerformAction(UltraGridAction.ExitEditMode, false, false);
//ultraGridForecast.PerformAction(UltraGridAction.BelowCell, false, false);
//the above line of code should work!! but it is making the cursor move to the left and right!!! SO!!
int activeCell = ultraGridForecast.ActiveCell.Column.Index;
int activeRow = ultraGridForecast.ActiveRow.Index;
if (activeRow != ultraGridForecast.Rows.FilteredInRowCount - 1)
{ultraGridForecast.ActiveRow = ultraGridForecast.Rows[activeRow + 1];ultraGridForecast.ActiveCell = ultraGridForecast.ActiveRow.Cells[activeCell];
}
e.Handled = true;
ultraGridForecast.PerformAction(UltraGridAction.EnterEditMode, false, false);
Hello Chitra,
Could you please review the sample attached to this post and see if it meets your requirements.Please feel free to let me know if I misunderstood you or if you have any other questions.
Hi Boris!!
I was wondering if you had any luck in figuring out this issue?! Please see my previous 3 posts in this thread for complete details. A quick overview of the issue, when you define UltraGridGroups for UltraWinGrid, the code to move cursor up and down like in Excel starts moving left and right....
I tried writing up some code - but if you have row filters on, things get buggy...
Look forward to hearing from you!!ThanksChitra
Thank you for your patience!
Here is how I was able to achieve it:
private void ultraGrid1_KeyDown(object sender, KeyEventArgs e) { UltraGridCell oldIndex = null;
switch (e.KeyCode) { case Keys.Up: oldIndex = ultraGrid1.ActiveCell; ultraGrid1.PerformAction(UltraGridAction.ExitEditMode, false, false); ultraGrid1.PerformAction(UltraGridAction.AboveRow, false, false); ultraGrid1.ActiveCell = ultraGrid1.ActiveRow.Cells[oldIndex.Column]; e.Handled = true; ultraGrid1.PerformAction(UltraGridAction.EnterEditMode, false, false); break; case Keys.Down: oldIndex = ultraGrid1.ActiveCell; ultraGrid1.PerformAction(UltraGridAction.ExitEditMode, false, false); ultraGrid1.PerformAction(UltraGridAction.BelowRow, false, false); ultraGrid1.ActiveCell = ultraGrid1.ActiveRow.Cells[oldIndex.Column]; e.Handled = true; ultraGrid1.PerformAction(UltraGridAction.EnterEditMode, false, false); break; case Keys.Right: ultraGrid1.PerformAction(UltraGridAction.ExitEditMode, false, false); ultraGrid1.PerformAction(UltraGridAction.NextCellByTab, false, false); e.Handled = true; ultraGrid1.PerformAction(UltraGridAction.EnterEditMode, false, false); break; case Keys.Left: ultraGrid1.PerformAction(UltraGridAction.ExitEditMode, false, false); ultraGrid1.PerformAction(UltraGridAction.PrevCellByTab, false, false); e.Handled = true; ultraGrid1.PerformAction(UltraGridAction.EnterEditMode, false, false); break; }
Please feel free to let me know if a question about our toolset comes up on your mind.
This is neat!! Clean!! WORKS!!! I was going to try to do something using ActiveScrollRegion per the suggestion of one of the other posts...
ThanksChitra
In a case like this, your EditingControl will be receiving the key message for the arrow key.
So you have to do something similar on your EditingControl that you are doing with the grid here. Trap keydown and watch for the arrow keys and then you can call the same PerformAction methods on the grid that you are using in this case.
If you don't want to write code in your EditingControl that is specific to the grid and you need a more generic solution, you could try to simulate the Tab key by calling SelectNextControl or using SendKeys.
I have implemented the excel like navigation as described above. I am using a UltraControlContainerEditor for the editor of a column in my grid. Once I navigate to this column using the arrow keys I cant navigate away using the arrow keys. It seems as though the key press event is not firing for the grid while the editor has focus, most likely because it is being handled by the editor embedded inside the cell. Is there anyway to achieve this arrow navigation with UCC editors? Maybe some property on UCC editor that will pass key events to the grid.
Thanks in advance!