Hi, I have an UltraCombo bound to an UltraGrids cell. While the cell is multiline, my users can edit a good portion of text in the cell. When using the ultracombo the users can select a string from a list of strings. This string will be copied into the cell and the users can edit this text. Now - when the users tries to navigate through the edited text with the arrow keys, he actually navigates through the ultracombos entries and the edited text is replaced by the string selected from the combox in an instant. How can i prevent the ultracombo from scrolling through the rows when hitting arrow keys?
Thanks for all helpful answers.
Actually with that solution i can move the cursor a position when pressing the arrow key. Is it possible to get the normal reaction for pressing the arrow key? Namely, that the cursor moves up or down a line?
Hi Martin,
I might have missed this requirement.
You could divide the 'if' statement into two - if Down and if Up. Then you could use:
ultraGrid1.ActiveCell.SelStart += 1;
and
ultraGrid1.ActiveCell.SelStart -= 1;
Sample:
if (e.KeyCode == Keys.Down) { ultraGrid1.ActiveCell.SelStart += 1; e.Handled = true; }
Please feel free to let me know if a question about our tool set comes up on your mind.
Hi,
thanks for your answer. The good thing is, the solution will prevent, that the user accidentially overwrites the edited text. The bad thing is, he can't navigate through the edited text with arrow keys. What would be the perfect solution.
Can I handle the keydown event for the arrow keys in the way, that the cursor switches the lines within the editorcomponent but without letting the ultracombo select the next row?
Hello,
A possible approach to achieve this might be by using the following code sample:
private void ultraGrid1_KeyDown(object sender, KeyEventArgs e) { if (ultraGrid1.ActiveCell.Column.Key == "Column 0") { if (e.KeyCode == Keys.Down || e.KeyCode == Keys.Up) { e.Handled = true; } } }
Please feel free to let me know if I misunderstood you or if you have any other questions.