Text box without buttons PDA barcode

hi, I have a problem that I don't know if it can be solved. I haven't been using App Inventor for very long.
I am trying to create an app to manage my warehouse and I have a PDA terminal with 1/2D barcode reader integrate.

Initially I had created the application so that when I went to the text box I went to scan the barcode, it was written in the box and then I pressed the confirm scan button to process it (however it is slower because for each barcode entered I have to go to press the button).

My question is: can i make it so that when I read the barcode with the pda (so when the text is written in the text box) the code is processed automatically without pressing any buttons?

Thanks so much.

How are you connecting up the barcode scanner and the textbox? If you're using the BarcodeScanner component in App Inventor it has an after scanning event, so when you populate the textbox you could also run a procedure containing the code in your button click event handler (procedures are a great way to share common code paths). If you're using an extension of some kind, it may have a similar event. If not, you may want to reach out to the extension developer and ask that it be added.

I have no event because my PDA terminal when reading the barcode is as if it were entering the code with the keyboard

Maybe Pegghi.

What have you tried? You might need a Clock but can do it without one.

What you can do with a TextBox is described in the link. The component only has two even handlers ( GotFocus() is an event raised when the TextBox is selected for input, such as by the user touching it.

LostFocus() is an event raised when the TextBox is no longer selected for input, such as if the user touches a different text box.

Unlike a Button, which has Click() that indicates that the user tapped and released the Button there isn't any way to recognize that the TextBox contains the read barcode.

However the Barcode scanner has to Blocks that might be useful

Events

AfterScan( result ) indicates that the scanner has read a (text) result and provides the result

DoScan() begins a barcode scan, using the camera. When the scan is complete, the AfterScan event will be raised.

It might be possible to trigger the DoScan immediately following AfterScan. This example works with my Android 8.1 tablet. Whether it works or not depends on the ability of your camera hardware to autofocus

autoScan

This is possible without a Clock

autoScan2

All barcodes were scanned without using the Button after the initial scan. Exit with the app's back button.

if I use the BarcodeScanner, my terminal automatically opens the camera for me and that's not what I want because my terminal has physical buttons to scan barcodes. this is a photo

:cry: You are not sharing code so who can guess. Most people do not use a gadget like your PDA scanner.

The TextBox does not have an event that shows or trips an event hander when the text changes, so a guess is you need a Clock somehow to determine that the value in the TextBox has changed; if it has changed, scan another code. Is your pda scanner now scanning automatically, without pressing a button on the device?

there is a physical button on the device

App Inventor Blocks cannot capture hard key events (except for the Back key). So you may have to use a Clock. Here is one way to monitor the contents of a TextBox.

clockCheckStatus

Button2 is to provide synthetic barcode data; you don't need that. You may want to reproduce the code as is and test; then use it with your unshared app code. As the text in the TextBox changes, the Procedure adds the data to a list (avoiding repeats).

Will this work? No idea, I do not have your device. Try the Blocks and let us know if this does what you hope for.

I solved it with your timer suggestion. When I go to enter the code with the terminal, the text box is full and then when the timer is finished I add it to the list and then empty the text box.

Thanks so much.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.