ListEditor: Fix crash when checking for duplicates if the Unique property is TRUE.

[GB.FORM]
* BUG: ListEditor: Fix crash when checking for duplicates if the Unique property is TRUE.
This commit is contained in:
gambas 2021-07-08 23:12:39 +02:00
parent 792c7bec6f
commit 42005272a9
7 changed files with 37 additions and 31 deletions

View file

@ -1,6 +1,6 @@
# Gambas Project File 3.0
Title=More controls for graphical components
Startup=FTestValueBox
Startup=FTestMaskBox
Icon=.hidden/icon.png
Version=3.16.90
VersionFile=1
@ -10,7 +10,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=en_US.UTF-8\n LC_ALL=zh_CN.UTF-8\n GTK_DEBUG=interactive"
Environment="GB_GUI=gb.gtk3\n GB_STOCK_DEBUG=1\n LANG=zh_CN.UTF-8\n LC_ALL=en_US.UTF-8\n LC_ALL=zh_CN.UTF-8\n GTK_DEBUG=interactive"
TabSize=2
Translate=1
Language=en

View file

@ -298,7 +298,7 @@ Private Sub CheckUnique()
I = 1
While I < lstData.Count
iPos = lstData.Find(lstData[I])
iPos = lstData.Find(lstData[I].Text)
If iPos <> I Then
lstData.Remove(I)
Else

View file

@ -18,7 +18,7 @@ Property Read Editor As Control
'' Return or set if duplicates are allowed in the list.
''
'' By default, this property is 'FALSE' and duplicate are allowed.
'' By default, this property is 'FALSE' and duplicates are allowed.
Property Unique As Boolean
'' Return or set the index of the current item.

View file

@ -6,3 +6,9 @@ Public Sub ListEditor1_Select()
Debug
End
Public Sub Form_Open()
ListEditor1.Index = 20
End

View file

@ -4,6 +4,7 @@
MoveScaled(0,0,64,64)
{ ListEditor1 ListEditor
MoveScaled(5,6,48,34)
List = [("Élément 1"), ("Élément 2"), ("Élément 3"), ("Élément 4"), ("Élément 5")]
Unique = True
}
}

View file

@ -13,28 +13,28 @@ Public Sub Button1_Click()
End
Public Sub MaskBox1_Validate()
Dim aAdr As String[]
Dim I As Integer
Dim sAdr As String
Dim iAdr As Integer
Dim bValid As Boolean
aAdr = Split(Last.Text, ".")
If aAdr.Count = 4 Then
For I = 0 To aAdr.Max
bValid = False
sAdr = Trim(aAdr[I])
If sAdr Then
Try iAdr = CInt(sAdr)
If Error Then Break
If iAdr < 0 Or If iAdr > 255 Then Break
Endif
bValid = True
Next
Endif
If Not bValid Then Stop Event
End
' Public Sub MaskBox1_Validate()
'
' Dim aAdr As String[]
' Dim I As Integer
' Dim sAdr As String
' Dim iAdr As Integer
' Dim bValid As Boolean
'
' aAdr = Split(Last.Text, ".")
' If aAdr.Count = 4 Then
' For I = 0 To aAdr.Max
' bValid = False
' sAdr = Trim(aAdr[I])
' If sAdr Then
' Try iAdr = CInt(sAdr)
' If Error Then Break
' If iAdr < 0 Or If iAdr > 255 Then Break
' Endif
' bValid = True
' Next
' Endif
'
' If Not bValid Then Stop Event
'
' End

View file

@ -8,7 +8,6 @@
}
{ MaskBox1 MaskBox
MoveScaled(13,34,24,4)
Mask = "###<.###<.###<.###<"
Prompt = MaskBox.Bracket
Mask = "####0<!.0000"
}
}