Hi,
I want to be able to allow a user to press a key on the grid and forward the key press to the cell that contains a drop down/drop down list. On doing this I want it to automatically select the first entry that matches. Is there any way to do this?
I set grid to only select a cell when it is clicked in InitializeLayout as follows:
.Layout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.CellSelect
I am currently only doing this for a text box as Boris has suggested in a previous post, but I thought I'd start a new thread for this one as it is slightly different.
I have the following to allow this for a text box.
Private fired As Boolean = False Private keyPressed As String = String.Empty Private Sub MyGrid_KeyUp(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles ui_ugWelds.KeyUp With MyGrid If .ActiveCell.IsInEditMode And (e.KeyCode = Keys.Enter Or e.KeyCode = Keys.Return) Then .PerformAction(UltraWinGrid.UltraGridAction.ExitEditMode, False, False) ElseIf Not .ActiveCell.IsInEditMode And UIHelper.IsValidEditorCharacter(e) Then keyPressed = UIHelper.GetChar(e) fired = True .PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode) ElseIf e.KeyCode = Keys.Escape Then .ActiveCell.Value = .ActiveCell.OriginalValue .PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.UndoCell) End If End With End Sub Private Sub MyGrid_AfterEnterEditMode(sender As System.Object, e As System.EventArgs) Handles ui_ugWelds.AfterEnterEditMode If fired Then With MyGrid If Not .ActiveCell.EditorResolved.SupportsDropDown Then .ActiveCell.Value = keyPressed If .ActiveCell.Value IsNot Nothing AndAlso .ActiveCell.EditorResolved.SupportsSelectableText Then .ActiveCell.SelStart = .ActiveCell.Value.ToString().Length End If End If End With End If fired = False End Sub
Thanks
Andez
Yes boris, that was spot on AGAIN thanks a million.
Hello Paul,
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,
From a user perspective they will tab or move to the cell with the drop down, press a key, and given that key press or maybe combination to cycle through the entries in the list. Pressing tab or enter would then move focus to the next cell. Hitting escape would cancel the cell edit and revert to the original value. They can still click the drop down and select using the mouse. If this is possible then that would be great.
Thanks,
Paul
Hello Andez,
It is good that you started a new thread so we can delimit the requirements and issue.
I have a few quick questions just to clarify your needs:
Where should your focus be initially? Is it in the cell with the dropdown or is it somewhere else and you want on a keypress to jump to the cell with the dropdown? And when you are in it, you want to find values like in "Windows Explorer" by typing with the keyboard, right?
Thank you in advance!