Jump to content

Is it posible work barcode scanner?


Ulugbek

Recommended Posts

Hello Ulugbek,

 

No problem for scanning barecode.

- Barecode is not depending of unigui.

- just put your cursor on an UniEdit and scann your product.

- you must creat a table wich contains, for exemple : ProductName, ExpirationDate, Price_Buy, Price, Barcode, Quantity.

It's not difficult.

Good luck...

Link to comment
Share on other sites

Thank you for you reply
Can you share example code or source?

For sample
On web form i have  
1) UniEditFindBarcode
2) UniNumberAmount
3) UniNumberQty
4) UniDbGrid Basket List Item
5) BigButton Pay
6) BigButton Clear

But how set cursor to UniEditFindBarcode when start reading or before reading scanner
If cursor not setting on UniEditFindBarcode cursor staying other controls grid or uniamt

Link to comment
Share on other sites

Hello Ulugbek,

 

Barcodescanner is the same as a keyboard ... the Barcodescanner scanns EAN Code or something else and sends it like the keyboard to the OS

 

I think the best way is:

 

  • Write a little programm with a global keyborad hook in delphi .. (a lot of tutorials in the web)
  • if your keyboard hook becomes a lot of numbers in a short time (timestamp-based analysis) then you can assume - that the barcodescanner is the sender of the numbers... a human can not enter 12 digits in the same time like a barcodescanner ;-)
  • Send via parameter a usernumber and the EAN-Code to your Server!! .. like www.domain.com/unigui.dll?user=123&ean=4564846
  • Search the running UNIGUI-session of the user and do with the EAN values what  you want ...

 

disadvantage:

1.) you must install the Trayicon-application on the client machine

2.) the client must have a open browser with your running unigui application

 

.. but the user must not focus the browser window - focus the edit-field and so on ... a more stable version

 

 

 

hth

Erich

Link to comment
Share on other sites

  • 4 weeks later...

Barcode scanner devices generally can work like a usb keyboard, o like a serial com device.

Working barcode scanner as usb keyboard is the simpliest  way, reading the codebar is like if your keyboard write the code in the focused control.

 

it's not necessary develope a keyboard hook, just put a unieditcontrol, focus on him, and read the codebar with the scanner..

or you can do a form that capture the onkeyevent, show this form , and capture the reading keys.

Link to comment
Share on other sites

Barcode scanner devices generally can work like a usb keyboard, o like a serial com device.

Working barcode scanner as usb keyboard is the simpliest  way, reading the codebar is like if your keyboard write the code in the focused control.

 

it's not necessary develope a keyboard hook, just put a unieditcontrol, focus on him, and read the codebar with the scanner..

or you can do a form that capture the onkeyevent, show this form , and capture the reading keys.

Can you give mini demo ?

Link to comment
Share on other sites

Сканер считывает шрих-код и отправляет строку контролу, который в фокусе.
Если в фокусе поле - то отображается в тексте, если в фокусе форма - то ловить надо через onkeyevent.

Link to comment
Share on other sites

What is key send barcode scanner ?

sorry, i don't understand what are you asking.

 

open a notepad or word, then scan the codebar and see what happened

 

For your unigui app is the same, it's  like if you are typing the code and pressing intro with the keyboard.

Link to comment
Share on other sites

Ok

I undertstand if i set webfocus EditControl then send barcode string into  editContorl and onkeyevent or onchange event i will be select from database.....

But how detect if webfocus setting on other control like button or unidbgrid i need before scanning set web focus editcontrol

Link to comment
Share on other sites

it not necesary put the focus in edit control,  there are several ways to do it, you can show new form to read, or read in focused control, or read all keys presed in active form / all controls.

 

See attached example. , it capture all keys pressed in all controls (no necessary focused on edit),  and determine if all keys are pressed fast (when reading from scanner all keys are typed very fast)

 

there are not diference using a non unigui app, the method is the same, you must capture all key's pressed and control when or where keys are pressed.

 

 

 

unitestscanread.rar

Link to comment
Share on other sites

  • 2 years later...
On 4/14/2016 at 11:03 AM, docjones said:

it not necesary put the focus in edit control,  there are several ways to do it, you can show new form to read, or read in focused control, or read all keys presed in active form / all controls.

 

See attached example. , it capture all keys pressed in all controls (no necessary focused on edit),  and determine if all keys are pressed fast (when reading from scanner all keys are typed very fast)

 

there are not diference using a non unigui app, the method is the same, you must capture all key's pressed and control when or where keys are pressed.

 

 

 

unitestscanread.rar

The link is broken. Is possible to download?

Thank you

Link to comment
Share on other sites

  • 10 months later...
  • 10 months later...

Testing the project, i notice that it takes a long time to process the data. 

Many times when using code bar scanners, data process with big speed is requiered.

How to process the data as soon a #13 character is receipt, that is eol is detected ?.

I activate synchronous mode but i notice no change.

Thanks for your soon help

Luis.

 

Link to comment
Share on other sites

On 6/22/2020 at 8:00 PM, Luis German said:

Many times when using code bar scanners, data process with big speed is requiered

I used java script  ListenEventEnable function when turn on the barcode listener 

it send  event with full barcode string to obj when got #13

function ListenEventEnable(obj) 
{
var barcode_i="";
var r_obj=obj

    document.addEventListener("keydown", onBackKeyDown, false);

    function onBackKeyDown(eve) {
     var key=eve.keyCode;

       if (key==13) 
    { 
         ajaxRequest(r_obj,"BARCODE",["value="+barcode_i]);
      barcode_i=""; 
    }
    else  barcode_i=barcode_i+String.fromCharCode((96 <= key && key <= 105) ? key-48 : key);    

    }
}

// and turn off listener
function ListenEventDisable() 
{
 document.removeEventListener("keydown",onBackKeyDown,false);
}

 

Link to comment
Share on other sites

Hi,


You can use an onkeydown event from the editbox where the barcode is read.

  if (key = vk_return) then begin
 
     // Step 1:
     // Search the database using a filter or query and check the barcode
     // only occurs once with a record count
    
     // Step 2:
     // Now do what you want to do now that the barcode has been found
  
    // Step 3:
    // Clear the field and focus on the edit field
   end;

Link to comment
Share on other sites

  • 2 weeks later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...