[GB.FORM]
* NEW: ListContainer now handles keyboard navigation and activation of its items. git-svn-id: svn://localhost/gambas/trunk@3263 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
8a67b56e60
commit
f00f1c6c43
5 changed files with 67 additions and 7 deletions
|
@ -10,6 +10,7 @@ Private $hPanel As DrawingArea
|
|||
Private $hImage As PictureBox
|
||||
Private $hLabel As TextLabel
|
||||
Private $iColor As Integer
|
||||
Private $bInside As Boolean
|
||||
|
||||
Event Click()
|
||||
|
||||
|
@ -52,7 +53,7 @@ End
|
|||
|
||||
Private Sub UpdateBorder()
|
||||
|
||||
$hPanel.Border = If($hPanel.Hovered Or $hPanel.HasFocus, Border.Plain, Border.None)
|
||||
$hPanel.Border = If($bInside Or $hPanel.HasFocus, Border.Plain, Border.None)
|
||||
|
||||
End
|
||||
|
||||
|
@ -67,6 +68,7 @@ Public Sub Panel_Enter()
|
|||
$iColor = hPanel.Foreground
|
||||
hPanel.Background = Color.LightBackground '&88D5FF&
|
||||
hPanel.Foreground = Color.Foreground '&88D5FF&
|
||||
$bInside = True
|
||||
UpdateBorder
|
||||
|
||||
End
|
||||
|
@ -80,6 +82,7 @@ Public Sub Panel_Leave()
|
|||
|
||||
hPanel.Background = Color.Default 'Last.Parent.Background
|
||||
hPanel.Foreground = $iColor
|
||||
$bInside = False
|
||||
UpdateBorder
|
||||
|
||||
End
|
||||
|
|
|
@ -1048,6 +1048,10 @@ Unlock
|
|||
m
|
||||
|
||||
|
||||
ScrollView_KeyPress
|
||||
m
|
||||
|
||||
|
||||
#MenuButton
|
||||
UserControl
|
||||
C
|
||||
|
|
|
@ -9,7 +9,7 @@ Component=gb.gui
|
|||
Component=gb.form
|
||||
Component=gb.settings
|
||||
Authors="Benoît Minisini"
|
||||
Environment="GB_GUI=gb.gtk"
|
||||
Environment="GB_GUI=gb.qt4"
|
||||
TabSize=2
|
||||
Translate=1
|
||||
Language=en
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
# Gambas Form File 3.0
|
||||
|
||||
{ Form Form
|
||||
MoveScaled(0,0,97,52)
|
||||
MoveScaled(0,0,97,56)
|
||||
{ tv TableView
|
||||
MoveScaled(3,1,34,30)
|
||||
Expand = True
|
||||
Header = GridView.Both
|
||||
}
|
||||
{ Panel1 Panel
|
||||
MoveScaled(1,34,90,8)
|
||||
MoveScaled(1,47,90,8)
|
||||
{ ComboBox1 ComboBox
|
||||
MoveScaled(2,2,24,4)
|
||||
List = [("Élément 1"), ("Élément 2"), ("Élément 3"), ("Élément 4"), ("Élément 5")]
|
||||
|
@ -25,7 +25,7 @@
|
|||
MoveScaled(53,2,8,4)
|
||||
}
|
||||
}
|
||||
{ SidePanel1 SidePanel
|
||||
MoveScaled(42,5,36,24)
|
||||
{ FontChooser1 FontChooser
|
||||
MoveScaled(39,2,54,43)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -288,7 +288,7 @@ Public Sub EnsureVisible()
|
|||
End
|
||||
|
||||
|
||||
Public Sub Select(hChild As control)
|
||||
Public Sub Select(hChild As Control)
|
||||
|
||||
SetSelected(hChild)
|
||||
EnsureVisible
|
||||
|
@ -339,3 +339,56 @@ Public Sub Unlock()
|
|||
If $iLock = 0 Then Me.Arrangement = Arrange.Vertical
|
||||
|
||||
End
|
||||
|
||||
Public Sub ScrollView_KeyPress()
|
||||
|
||||
Dim hCurrent As Control
|
||||
Dim iIndex As Integer
|
||||
|
||||
If Not Key.Normal Then Return
|
||||
|
||||
iIndex = Index_Read()
|
||||
|
||||
If Key.Code = Key.Up Then
|
||||
While iIndex > 0
|
||||
Dec iIndex
|
||||
Index_Write(iIndex)
|
||||
If Index_Read() = iIndex Then
|
||||
Stop Event
|
||||
Return
|
||||
Endif
|
||||
Wend
|
||||
Else If Key.Code = Key.Down Then
|
||||
While iIndex < (Count_Read() - 1)
|
||||
Inc iIndex
|
||||
Index_Write(iIndex)
|
||||
If Index_Read() = iIndex Then
|
||||
Stop Event
|
||||
Return
|
||||
Endif
|
||||
Wend
|
||||
Else If Key.Code = Key.Home Then
|
||||
iIndex = 0
|
||||
While iIndex < Count_Read()
|
||||
Index_Write(iIndex)
|
||||
If Index_Read() = iIndex Then
|
||||
Stop Event
|
||||
Return
|
||||
Endif
|
||||
Inc iIndex
|
||||
Wend
|
||||
Else If Key.Code = Key.End Then
|
||||
iIndex = Count_Read() - 1
|
||||
While iIndex > 0
|
||||
Index_Write(iIndex)
|
||||
If Index_Read() = iIndex Then
|
||||
Stop Event
|
||||
Return
|
||||
Endif
|
||||
Dec iIndex
|
||||
Wend
|
||||
Else If Key.Code = Key.Space Then
|
||||
If GetSelected() Then Raise Activate
|
||||
Endif
|
||||
|
||||
End
|
||||
|
|
Loading…
Reference in a new issue