[Gambas-user] Empty ComboBox are filled while scrolling mouse without key press (gb.qt5)
Gianluigi
gradobag at gradobag.it
Mon Oct 2 10:16:17 CEST 2023
Il 02/10/23 05:38, Safiur Rahman ha scritto:
> Stop Events works for Panel and other containers but doesn't work with
> ComboBox
>
> This works
> Public Sub Panel1_MouseWheel()
> If Mouse.Delta Then Stop Event
> End
>
> This does not work
> Public Sub ComboBox1_MouseWheel()
> If Mouse.Delta Then Stop Event
> End
>
> Also setting the ComboBox to ReadOnly while the mouse cursor is over
> it makes no difference because you can still change text of ReadOnly
> ComboBox with mouse wheel scroll.
This improves the situation but does not solve it:
------------------------------------------------------
Private aValue As New String[]
Private hCombo As ComboBox
Public Sub Form_Open()
Dim i As Integer
Dim aList As String[] = ["aa", "bb", "cc", "dd", "ee"]
Dim hScroll As ScrollView
With Me
.Arrangement = Arrange.Fill
.W = 220
.h = 500
.Margin = True
End With
With hScroll = New ScrollView(Me) As "hScroll"
.ScrollBar = Scroll.Vertical
.Arrangement = Arrange.Vertical
.Spacing = True
End With
For i = 0 To 20
With hCombo = New ComboBox(hScroll) As "hCombo"
.Name = i
.H = 30
.List = aList
End With
Next
End
Public Sub hCombo_MouseWheel()
If Mouse.Delta Then
Last.text = ""
Stop Event
Endif
For i As Integer = 0 To 20
If i = Val(hCombo.Name) Then
If hCombo.Text = "" Then Return
hCombo.Text = aValue[i]
Break
Endif
Next
End
Public Sub hCombo_Change()
aValue.Add(Last.Text, Val(Last.Name))
End
---------------------------------------------
Regards
Gianluigi
More information about the User
mailing list