DateChooser: Handle mouse wheel events on time boxes better.

[GB.FORM]
* NEW: DateChooser: Handle mouse wheel events on time boxes better.
This commit is contained in:
gambas 2020-11-18 21:59:08 +01:00
parent 306b1561ec
commit 38eabb2a3a
5 changed files with 41 additions and 12 deletions

View file

@ -9,7 +9,7 @@ Component=gb.form
Component=gb.settings
Component=gb.form.stock
Authors="Benoît Minisini"
Environment="GB_GUI=gb.qt5\n GB_STOCK_DEBUG=1\n LANG=zh_CN.UTF-8\n LC_ALL=zh_CN.UTF-8"
Environment="GB_GUI=gb.qt5\n GB_STOCK_DEBUG=1\nLANG=zh_CN.UTF-8\nLC_ALL=zh_CN.UTF-8"
TabSize=2
Translate=1
Language=en

View file

@ -146,11 +146,11 @@ Public Sub ButtonBox_Click()
Dim dDate As Date
If $bShowTime And $bShowDate Then
$hPopup.Resize(Desktop.Scale * 60 + 2, ((Desktop.Scale * 32) \ 12) * 12 + 2)
$hPopup.Resize(Desktop.Scale * 72 + 2, ((Desktop.Scale * 32) \ 12) * 12 + 2)
Else If $bShowDate
$hPopup.Resize(Desktop.Scale * 40 + 2, Desktop.Scale * 32)
Else
$hPopup.Resize(Desktop.Scale * 24 + 2, ((Desktop.Scale * 32) \ 12) * 12 + 2)
$hPopup.Resize(Desktop.Scale * 32 + 2, ((Desktop.Scale * 32) \ 12) * 12 + 2)
Endif
iPad = If($hButtonBox.Border, 3, 0)

View file

@ -63,11 +63,25 @@ Private Sub GetTimeFormat() As String
End
Private Sub UpdateTimeWidth()
If panDate.Visible Then
If panTime.Visible Then
panTime.Expand = False
panTime.W = Desktop.Scale * 32
Else
Endif
Else
If panTime.Visible Then
panTime.Expand = True
Endif
Endif
End
Public Sub _new()
panTime.W = Desktop.Scale * 24
UpdateTimeWidth
FillMonth(False)
$dDate = Now
@ -725,6 +739,7 @@ Public Sub SetShowTime(bShowTime As Boolean)
If Not GetShowDate() And Not bShowTime Then Error.Raise("Bad argument")
panTime.Visible = bShowTime
sepTime.Visible = GetShowTime() And GetShowDate()
UpdateTimeWidth
End
@ -739,6 +754,7 @@ Public Sub SetShowDate(bShowDate As Boolean)
If Not GetShowTime() And Not bShowDate Then Error.Raise("Bad argument")
panDate.Visible = bShowDate
sepTime.Visible = GetShowTime() And GetShowDate()
UpdateTimeWidth
End
@ -838,10 +854,24 @@ Public Sub txtMinute_MouseWheel()
If Mouse.Forward Then
Inc iMinute
If iMinute > 59 Then iMinute = 0
If iMinute > 59 Then
If Hour($dTime) = 23 Then
Stop Event
Return
Endif
iMinute = 0
txtHour_MouseWheel
Endif
Else
Dec iMinute
If iMinute < 0 Then iMinute = 59
If iMinute < 0 Then
If Hour($dTime) = 0 Then
Stop Event
Return
Endif
iMinute = 59
txtHour_MouseWheel
Endif
Endif
SetTime(Time(Hour($dTime), iMinute, 0))

View file

@ -85,13 +85,13 @@
{ Panel3 Panel
MoveScaled(8,0,8,4)
Background = Color.TextBackground
{ txtHour TextBox
MoveScaled(0,0,4,4)
{ txtMinute TextBox
MoveScaled(4,0,4,4)
Alignment = Align.Right
Border = False
}
{ txtMinute TextBox
MoveScaled(4,0,4,4)
{ txtHour TextBox
MoveScaled(0,0,4,4)
Alignment = Align.Right
Border = False
}

View file

@ -39,7 +39,6 @@
{ dwgGradient DrawingArea
MoveScaled(6,0,2,4)
Ignore = True
NoBackground = True
}
}
{ Separator3 Separator