IconView: Handle 'PageDown' and 'PageUp' keys.

[GB.GUI.BASE]
* NEW: IconView: Handle 'PageDown' and 'PageUp' keys.
This commit is contained in:
Benoît Minisini 2022-12-31 07:34:10 +01:00
parent b0c3c0e32f
commit de07a867e4
2 changed files with 18 additions and 1 deletions

View File

@ -1,6 +1,6 @@
# Gambas Project File 3.0
Title=Common controls and classes for GUI components
Startup=FTestTreeView
Startup=FTestIconView
Icon=.hidden/window.png
Version=3.17.90
VersionFile=1

View File

@ -847,6 +847,8 @@ Public Sub ScrollArea_KeyPress()
Dim iInd As Integer
Dim iPos As Integer
Dim iStart As Integer
Dim N As Integer
Dim iCurrent As Integer
If Not Me.Enabled Or If Me.Design Then Return
@ -894,6 +896,21 @@ Public Sub ScrollArea_KeyPress()
SetCurrentItem($iCurrent + $nColumn, True, bShift)
Endif
Stop Event
Case Key.PageUp, Key.PageDown
If $bHorizontal Then
N = $hView.ClientW \ $iGridWidth
Else
N = $hView.ClientH \ $iGridHeight
Endif
N = Max(1, N)
If iCode = Key.PageUp Then
iCurrent = $iCurrent - N * $nColumn
If iCurrent < 0 Then iCurrent += (Abs(iCurrent + 1) \ $nColumn + 1) * $nColumn
Else
iCurrent = Min($aItems.Max, $iCurrent + N * $nColumn)
Endif
SetCurrentItem(iCurrent, True, bShift)
Case Key.Home
SetCurrentItem(0, True, bShift)