Android Question How to trap "carriage return" when I scan a barcode with a Zebra Handheld TC56.

joaquinortiz

Active Member
Licensed User
Longtime User
Hello again, fellows!.

I have a Zebra Handheld TC56 model. I configured Datawedge in a way that every scan I made, it displayed in my B4XFloatTextField. I follow other threads in the forum and I found that other fellows use intent. I don't want to use intent. I want to trap "carriage return" after reading a barcode in B4XFloatTextField, to execute a SELECT command for searching some data in a table.

I usually do it in C# (In Windows Mobile). Is there a way to do it in B4A?

Thanks in advance!.
 

Attachments

  • IMG_20200529_001754.jpg
    IMG_20200529_001754.jpg
    56 KB · Views: 347
  • IMG_20200529_001820.jpg
    IMG_20200529_001820.jpg
    77.2 KB · Views: 370
  • IMG_20200529_002259.jpg
    IMG_20200529_002259.jpg
    89.8 KB · Views: 320
  • IMG_20200529_002857.jpg
    IMG_20200529_002857.jpg
    171.2 KB · Views: 363

joaquinortiz

Active Member
Licensed User
Longtime User
Use the TextChanged event to capture any change and check the content. If it ends with CRLF (or similar), do your search. Here you can check any value (length, etc), too

I have tested this suggestion with the following code.

B4X:
Sub txtSearch_TextChanged (Old As String, New As String)

    Dim MySize, i As Int
    Dim MyChar As String
    
    MySize = New.Length
    For i= 1 To MySize
        MyChar = myUtilerias.Mid(New,i,1)
        If MyChar = CRLF Then
            myUtilerias.myMsgBox(Activity,"Its Works!!....HERE I make t he search!","OK","","")
        End If
    Next

End Sub

I tested my app, with this code, with a Honeywell CK75 handheld and in a Zebra TC56 model and it doesn't works using TextChanged event and CRLF.

Any other idea?

Thanks in advance, for your time helping me!!.
 
Upvote 0

udg

Expert
Licensed User
Longtime User
Are you aware that CRLF = Chr(10)? This is true for B4J, B4A and B4i.
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
You would actually be better of using broadcast receiver, there should be a setting in the app designed for the scanner. I develop on barcode scanners and I always use the broadcast receiver, just capture the intent it's easy enough to do, there's no need to capture carriage return.
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
Who printed barcodes? If it's you your text that will be converted into barcode should be like *12345*
 
Upvote 0

fatman

Active Member
Licensed User
Longtime User
Hi,

I do it like that:

B4X:
Sub check_barcode
    Dim Code As String
    Code = EditText1.Text
    If Code.Length = 13 Then ' EAN13
        '
        ' Here you may check the code against a code in a databsse
        '
    End If
End Sub

Sub EditText1_EnterPressed
    check_barcode
End Sub

Hope this helps
 
Upvote 0
Top