Dorry for the delay.
What are these Select Case for ?
I understand the test part, but after your descripton, I do not understand. I have some things to do (right now), and I will make other testings in a brand new project (instead of a code addition to an existing project).
ExpandRow: I would use these keys too (Enter AND Return).
You do not have a PushButton that have the Default behavior ? I do not understand
how that can come.
What the Return True
in MouseDown
is meant to do ?
I used this code (and nothing in KeyDown):
[code]Sub KeyUp(Key As String)
Select Case Key
case ChrB(3)
// Enter
If Me.ListIndex > -1 Then
MsgBox “OK”
Return
End If
Case ChrB(13)
// Return
If Me.ListIndex > -1 Then
MsgBox “OK”
Return
End If
Case ChrB(28)
Me.Expanded(Me.ListIndex) = False
Return
Case ChrB(29)
Me.Expanded(Me.ListIndex) = True
Return
End Select
End Sub[/code]
The window have only the Listbox, and the two arrow keys works fine.
I confirm what you said: pressing Return close the MsgBox, but the Listbox also trap that Return and display another MsgBox as nauseam.
This one follows the LR instructions (Listbox.KeyUp):
case ChrB(3)
// Enter
If Me.ListIndex > -1 Then
MsgBox "OK"
ClearFocus
End If
And I do not get a second MsgBox !