JaedenRuiner
Well-known member
- Joined
- Aug 13, 2007
- Messages
- 340
- Programming Experience
- 10+
Okay,
I designed this a while ago and it appeared to work then, but something has changed and I'm not exactly sure what.
In effect I have a ComboBox Hovering over a ListView, and is moved/redrawn over the "SubItems" (column 1 of the listview) for editing purposes. The presentation is quite spectactular (imo) but I'm getting a weird glitch.
Before I was using arrays as the the DataSource of the ComboBox, but due to further complications of the application I've changed it to datatables with appropriate Display/Value members.
The setup is simple:
(This is Pseudo code in case that isn't obvious)
So yea, at the end of my selection change in the "ListView" i return the focus to the ComboBox.
THe Idea here was simple, that when the ComboBox is Not in a currently DropDown-ed state, the Arrow Keys (up/down) are passed back up to the ListView control, which then goes to the next item, moves the ComboBox and returns focus to it.
However, I also have "AutoCompleteMode = SuggestAppend" and "AutoCompleteSource = ListItems". Before I don't think this happened, but it is happening now, that when I type the first character of an item in the list, there are often more than one item with that as the first letter.
So far so good, it is handling as it should. But now, I press down/up arrow, and the combobox reverts to thinking I'm still looking for a Suggested value or whatnot and my KeyDown event for the ComboBox is no longer being triggered. This behavior persists, forcing me to use the mouse to select the next item in the listview (or tabbing in and out of the control to move into the listview) but even on other items that behavior maintains, the up/down returning to the "SuggestAppend" "History" or something. But when I delete the suggestappend text from being entered and select an item from the drown down with the mouse or arrow keys, the keydown event works again and my old (desired) behavior resumes.
How can the control currently effect my KeyDown Event to not be processed once a SuggestAppend autocomplete mode has been triggered, and how might I eliminate that behavior upon pressing the Enter Key. in the control, etc, etc, etc.
Thanks
I designed this a while ago and it appeared to work then, but something has changed and I'm not exactly sure what.
In effect I have a ComboBox Hovering over a ListView, and is moved/redrawn over the "SubItems" (column 1 of the listview) for editing purposes. The presentation is quite spectactular (imo) but I'm getting a weird glitch.
Before I was using arrays as the the DataSource of the ComboBox, but due to further complications of the application I've changed it to datatables with appropriate Display/Value members.
The setup is simple:
(This is Pseudo code in case that isn't obvious)
VB.NET:
ListView_SelectedItemChanged() {
if e.item.Group = LV.Group(0) then
ItemCmb.DataSource = DS1
else
ItemCmb.Datasource = DS2
end if
ItemCmb.Location = MovedLocationFromSubItem()
ItemCmb.Focus() ' <-- the important line!!!
}
VB.NET:
Private Sub ItemCmb_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ItemCmb.KeyDown
If Not ItemCmb.DroppedDown Then
If (e.KeyCode = Keys.Up OrElse e.KeyCode = Keys.Down) AndAlso (Not (e.Shift OrElse e.Alt OrElse e.Control)) Then
e.SuppressKeyPress = True
lvImpMap.Select()
lvImpMap.Focus()
SendKeys.SendWait(IIf(e.KeyCode = Keys.Up, "{UP}", "{DOWN}"))
End If
End If
End Sub
However, I also have "AutoCompleteMode = SuggestAppend" and "AutoCompleteSource = ListItems". Before I don't think this happened, but it is happening now, that when I type the first character of an item in the list, there are often more than one item with that as the first letter.
- Code
- Name
- City
- State
- Street
- Zip
So far so good, it is handling as it should. But now, I press down/up arrow, and the combobox reverts to thinking I'm still looking for a Suggested value or whatnot and my KeyDown event for the ComboBox is no longer being triggered. This behavior persists, forcing me to use the mouse to select the next item in the listview (or tabbing in and out of the control to move into the listview) but even on other items that behavior maintains, the up/down returning to the "SuggestAppend" "History" or something. But when I delete the suggestappend text from being entered and select an item from the drown down with the mouse or arrow keys, the keydown event works again and my old (desired) behavior resumes.
How can the control currently effect my KeyDown Event to not be processed once a SuggestAppend autocomplete mode has been triggered, and how might I eliminate that behavior upon pressing the Enter Key. in the control, etc, etc, etc.
Thanks