DataComboView: Handle keyboard shortcuts: Space, Enter, Down, and Escape key.

[GB.DB.FORM]
* NEW: DataComboView: Handle keyboard shortcuts: Space, Enter, Down, and Escape key.
This commit is contained in:
gambas 2020-08-20 01:37:47 +02:00
parent 0720b6763d
commit 6a505680e2
6 changed files with 78 additions and 19 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View file

@ -9,7 +9,7 @@ Component=gb.gui
Component=gb.form
Component=gb.db
Authors="Benoît Minisini"
Environment="GB_GUI=gb.qt5"
Environment="GB_GUI=gb.gtk3\nGTK_DEBUG=interactive"
TabSize=2
Translate=1
Language=en

View file

@ -186,6 +186,17 @@ Public Sub TableView_MouseUp()
End
Public Sub TableView_KeyPress()
If Key.Code = Key.Space Or If Key.Code = Key.Enter Or If Key.Code = Key.Return Then
TableView_MouseUp
Else If Key.Code = Key.Escape Then
$hPopup.Close
Endif
End
Private Function Filter_Read() As String
Return $hSrc.Filter
@ -450,25 +461,21 @@ End
Public Sub DrawingArea_KeyPress()
If Key.Code = Key.Space Then
If Key.Code = Key.Space Or If Key.Code = Key.Down Then
$bPressed = True
$hDrawingArea.Refresh
' Else If Key.Code = Key.Tab Then
' If $hButton Then
' Try Me.Next.SetFocus
' Stop Event
' Endif
Endif
End
Public Sub DrawingArea_KeyRelease()
If Key.Code = Key.Space Then
$bPressed = False
$hDrawingArea.Refresh
Wait
'Button_Click
If Key.Code = Key.Space Or If Key.Code = Key.Down Then
If $bPressed Then
$bPressed = False
$hDrawingArea.Refresh
OpenPopup
Endif
Endif
End

View file

@ -1,9 +1,19 @@
# Gambas Form File 3.0
{ Form Form
MoveScaled(7.375,20.375,41,24)
MoveScaled(7.3333,20.3333,41,24)
Resizable = False
Arrangement = Arrange.Fill
{ Menu1 Menu
Text = ("Menu1")
Visible = False
{ Menu2 Menu
Text = ("Menu2")
}
{ Menu3 Menu
Text = ("Menu3")
}
}
{ panBorder Panel
MoveScaled(1,1,38,22)
Arrangement = Arrange.Vertical

View file

@ -7,3 +7,30 @@ Public Sub Button3_Click()
DataBrowser1.Editable = Button3.Value
End
Public Sub Button4_Click()
Me.Resize(300, 300)
End
Public Sub Button5_Click()
Me.Menus.Visible = Not Me.Menus.Visible
End
Public Sub Timer1_Timer()
If CInt(Timer) = 10 And If Not Me.Maximized Then
Error "MAXIMIZED!"
Me.Maximized = True
Endif
End
Public Sub Button6_Click()
Me.Maximized = Not Me.Maximized
End

View file

@ -1,30 +1,42 @@
# Gambas Form File 3.0
{ Form Form
MoveScaled(0,0,68,59)
MoveScaled(0,0,101,72)
#Translate = False
Arrangement = Arrange.Vertical
Spacing = True
Margin = True
{ HBox1 HBox
MoveScaled(1,1,64,4)
MoveScaled(1,1,96,4)
Spacing = True
{ Button1 Button
MoveScaled(0,0,13,4)
MoveScaled(0,0,9,4)
Text = ("Create")
}
{ Button2 Button
MoveScaled(14,0,13,4)
MoveScaled(10,0,10,4)
Text = ("Refresh")
}
{ ComboBox1 ComboBox
MoveScaled(28,0,15,4)
MoveScaled(21,0,15,4)
List = [("Élément 1"), ("Élément 2"), ("Élément 3"), ("Élément 4"), ("Élément 5"), ("Élément 6"), ("Élément 7")]
}
{ Button3 ToggleButton
MoveScaled(45,0,16,4)
MoveScaled(37,0,11,4)
Text = ("Editable")
}
{ Button4 Button
MoveScaled(49,0,9,4)
Text = ("Resize")
}
{ Button5 Button
MoveScaled(59,0,9,4)
Text = ("Menu")
}
{ Button6 Button
MoveScaled(69,0,12,4)
Text = ("Maximized")
}
}
{ DataSource1 DataSource
MoveScaled(1,6,55,40)
@ -44,4 +56,7 @@
Grid = True
}
}
{ Timer1 #Timer
#MoveScaled(77,18)
}
}