PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: ListView - Keyboard  (Read 295 times)

SeaVipe

  • Senior Member
  • ***
  • Posts: 437
  • Windows 10
ListView - Keyboard
« on: February 15, 2022, 01:21:21 PM »

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?
Logged
Clive Richey
You're Either Part Of The Solution, Or You're The Problem.
#StaySafe, Always  Keep A Safe #SocialDistance, #WashYourHands Often and please, #StayHome!

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9497
  • Windows 10
    • PlanetSquires Software
Re: ListView - Keyboard
« Reply #1 on: February 16, 2022, 10:00:22 AM »

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.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9497
  • Windows 10
    • PlanetSquires Software
Re: ListView - Keyboard
« Reply #2 on: February 16, 2022, 10:11:10 AM »

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.

Code: [Select]
''
''
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
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

SeaVipe

  • Senior Member
  • ***
  • Posts: 437
  • Windows 10
Re: ListView - Keyboard
« Reply #3 on: February 16, 2022, 01:05:07 PM »

Perfect, thanks, Paul.
Logged
Clive Richey
You're Either Part Of The Solution, Or You're The Problem.
#StaySafe, Always  Keep A Safe #SocialDistance, #WashYourHands Often and please, #StayHome!