ListView - Keyboard

Started by SeaVipe, February 15, 2022, 01:51:21 PM

Previous topic - Next topic

SeaVipe

Hi Paul,
On a ListView control, all of the alpha and numeric keyboard keys will move the selected row to the top. Other keys function as expected.
Can this behaviour be changed or disabled?
Clive Richey

Paul Squires

Hi Clive, I am looking into this now. I haven't used the visual designer much in the last few months so I am reacquainting myself with the code.
Paul Squires
PlanetSquires Software

Paul Squires

Hi Clive,

The following code show work. It allows you to filter what keypresses to allow/disallow for your Listview. Make sure to enable the "KeyDown" event for your Listview.


''
''
Function frmMainJ_lvJournal_KeyDown( ByRef sender As wfxListView, ByRef e As EventArgs ) As LRESULT
   select case e.KeyCode
      case VK_TAB, VK_UP, VK_DOWN, VK_NEXT, VK_PRIOR, VK_HOME, VK_END
         ' we allow these keys so let them pass to the framework.
      case else
         ' do not process any other keys so let the framework know
         ' that we have handled them.
         e.Handled = true   
   end select
   Function = 0
End Function

Paul Squires
PlanetSquires Software

SeaVipe

Clive Richey