I will make a long (too long) story short:
i had troubles setting the delete key as the MenuItem.Key of EditClear. It works nicely in another project (thanks shao shen for the trick), worked fine in a brand new (vlean) project / and I never was able to make it not working in a brand new project.
I stripped down the project with troubles until I get it working fine without changing the code that deals with EditClear.
At last, minutes ago, I found (watch the code below) that ListBox.KeyDown (after checking ListBox.CellKeyDown (comment the code) is the faultive.
Note: the code in ListBox.CellKeyDown stayed commented when I started to test the code in ListBox.KeyDown.
LBN: I am no more able to make the code working once I started to comment the arrow code to try to know what If block is faultive (and none is if I can tell that), until I found that now, even with the whole block of IFs is commented (watch below), no the Delete key does no more works.
And I know that I do not saw a black cat while I was driving my car or walking earlier (today / yesterday).
Desesperate, I am completely desesperate ! Help !
Below is the (minutes ago) offending code !
[code] If Key = Chr(28) Then // Left Key: move to top
If LB.ListIndex <> 0 Then // Goes to the previous Row #
// Go to the Previous Row
LB.ListIndex = LB.ListIndex - 1
// Keep the focus in the ListBox
Me.SetFocus
// Key handled !
Return False
Else // The Selected Row is #0
// Loop: go directly to the last Row
LB.ListIndex = LB.ListCount - 1
// Keep the focus in the ListBox
Me.SetFocus
// Key handled !
Return False
End If
End If
If Key = Chr(29) Then // Right Key: move to bottom
If LB.ListIndex < (LB.ListCount - 1) Then
// increase the value of the selected Row #
LB.ListIndex = LB.ListIndex + 1
// Keep the focus in the ListBox
Me.SetFocus
// Key handled !
Return False
Else // Loop: go directly to the first Row
LB.ListIndex = 0
// Keep the focus in the ListBox
Me.SetFocus
// Key handled !
Return False
End If
End If
If Key = Chr(30) Then // Bottom Key: move to bottom
If LB.ListIndex <> 0 Then // Goes to the previous Row #
// Go to the Previous Row
LB.ListIndex = LB.ListIndex - 1
// Keep the focus in the ListBox
Me.SetFocus
// Key handled !
Return True
Else // The Selected Row is #0
// Loop: go directly to the last Row
LB.ListIndex = LB.ListCount - 1
// Keep the focus in the ListBox
Me.SetFocus
// Key handled !
Return True
End If
End If
If Key = Chr(31) Then // Top Key: move to bottom
If LB.ListIndex < (LB.ListCount - 1) Then
// increase the value of the selected Row #
LB.ListIndex = LB.ListIndex + 1
// Keep the focus in the ListBox
Me.SetFocus
// Key handled !
Return True
Else // Loop: go directly to the first Row
LB.ListIndex = 0
// Keep the focus in the ListBox
Me.SetFocus
// Key handled !
Return True
End If
End If
[/code]
The delete key is meant to delete a Row from the ListBox (you may guess) and the test file loaded in the ListBox is the same, always dragged from the Finder. The only change is the Row I select (to be deleted). BUT IT CANNOT BE THAT.