Hi,
I have few textfeilds, a grid and few buttons in a form. When my form loads my first focus goes to the first textfield and then when I hit the "TAB" key, it moves on to the other textfields. Then I have set my tab index to the Groupbox which the Grid resides and then to the Grid. The tabbing goes fine until the Grid first cell (where it goes to the method ultraGrid1_Enter), then jumps straight away to the buttons in the bottom which has really annoys me!! :(
What I want is as soon as the grid is focused, it should navigate through cells which are in editmode using the "TAB" key (usershould be able to make any changes while in that cell)
After reading some forums, I have added the ultraGrid1_BeforePerformAction method, but it WONT go to that method at all!! but when i press the arrow keys from the grid focus position, it moves thorugh the cells (going through that ultraGrid1_BeforePerformAction ) method, but it wont show the editMode fields.
For your information, i have used some editors for some of the colums, which is also in editmode, and i'm thinking whether these giving a bug for that tabbing problem :-?
I have set the TabIndexes in the following order:
textboxes -> groupbox -> grid -> grid cells -> buttons
Below shows the methods which i used , which is not helpful at all....
private void ultraGrid1_Enter(object sender, EventArgs e)
{
UltraGrid grid = (UltraGrid)sender;
if (grid.Rows.Count > 0)
grid.ActiveCell = grid.Rows[0].Cells[1];
grid.PerformAction(UltraGridAction.EnterEditMode);
}
///////////////////////////////
private void ultraGrid1_BeforePerformAction(object sender, BeforeUltraGridPerformActionEventArgs e)
if (e.UltraGridAction == UltraGridAction.NextCell)
///////////////////////////
private void ultraGrid1_KeyDown(object sender, KeyEventArgs
e)
if (e.KeyCode == Keys.Tab)
ultraGrid1.PerformAction(UltraGridAction.NextCellByTab);
Please someone help me regarding this matter as it is very urgent!! :(
Sample code is much needed...
Thanks in Advance!!
I'm sorry, but I am not really sure what you are asking. Your first few sentences seem to describe the correct behavior of the grid, but then the rest of your post contradicts what you said.
The default behavior of the grid is to tab through the cell in the row, then move to the next row. This can be changed in a number of ways, such as setting the TabNavigation property, handling events, or modifying the grid's KeyActionMappings.
But it's really not clear from your post what behavior you want. From the code, it looks like you are trying to implement the default behavior of the grid, which doesn't make sense, since you would be re-implementing what the grid already does. Perhaps you are setting TabNavigation in your code?
hi Mike, Thanks for your reply.
I have tried the TabNavigation property and set it to NextControlOnLastCell and then if I only MOUSE click on the cell it will make editable, and when i then hit the tab it will move on to the next cell and move on till the next control.
But what I want is without mouse clicking the cell, when the grid is focused, the first cell in the grid, which has the following properties set:
CellActivation = AllowEdit
EditorControl = ultraComboEditor
Nullable = EmptyString
and shoudl be selected and be in ready to edit mode. And after that when I hit TAB to move on through the grid cells.
Please let me know how to activate the frist cell without mouse clicking. Thats all i needed. I have tried the following method. It's going throu it when the grid is focused But it wont show any focus anywhere in the grid. The focus has gone no where.
grid.ActiveCell = grid.Rows[0].Cells[0];
grid.ActiveCell.Activate();
grid.Rows[0].Cells[0].Selected =
true;
grid.PerformAction(
UltraGridAction.EnterEditMode);
Please tell me where i have gone worng :(
Urgent help needed. let me know if u need more info.
thanks.