I have an app where the user can use a barcode scanner to put data in an B4XFloatTextField control.
The B4XFloatTextField control is labeled Part_Number.
To determine when the barcode scan has completed, I use the code below:
The user must program the barcode scanner to have a suffix of #### - four pound characters. Then my code detects the suffix to accept the entry.
This is kind of cumbersome. Does anyone have a better way to determine when a barcode scan has completed?
The B4XFloatTextField control is labeled Part_Number.
To determine when the barcode scan has completed, I use the code below:
B4X:
Sub Part_Number_TextChanged (Old As String, New As String)
Dim ThisPart As String = New.ToUpperCase
If ThisPart.EndsWith( "####" ) = True Then
Dim StringLen As Int = ThisPart.IndexOf( "####" )
Part_Number.Text = ThisPart.SubString2(0,StringLen).Trim
AddItem
End If
End Sub
The user must program the barcode scanner to have a suffix of #### - four pound characters. Then my code detects the suffix to accept the entry.
This is kind of cumbersome. Does anyone have a better way to determine when a barcode scan has completed?