FNC WC - BarcodeDecoder - BarcodeType runtime selection

Hi, I would like to know how to correctly set the BarcodeType at program runtime on mobile device.

If I set at design time, in Object Inspector, BarcodeType to bdtEAN, I can scan barcodes of store products that are 13-digits.

If I need to change it at run time to something else and continue scanning the new barcode, take a 8-digit code on products like the small size "M&M Peanuts" pk's, the barcode does not get scanned.

Code I use is this one that I came up with, but it may be wrong. It's tstrings is filled with the bdtNNN values in a tcombobox, and when I select a value, its suppose to change barcodetype to it, but maybe the code is incorrect. Below, I tried two versions of the code but they are not working. I am doing something wrong.

Please advise on how to build that part, thank you much!

procedure TForm1.cbBarcodeListChange(Sender: TObject);
//var s,ss:string; i:integer;
  // set to new BarcodeType;
  // memo1.Lines.Add(cb1.Selected.Text); //testing for values
  // memo1.Lines.Add(inttostr(cb1.ItemIndex)); // testing for values
  bcode.BarcodeType := TTMSFNCWXBarcodeDecoderType(cbBarcodeList.ItemIndex);

//  s:=cbBarcodeList.Selected.Text;
//  bcode.BarcodeType := TTMSFNCWXBarcodeDecoderType(integer(s));
////  ss := string(bcode.BarcodeType);

okay, I think I found out why the routine above does not work. The list is ordered differently in the type section versus what is listed in the Object Inspector's because I created the list in the order I saw in the Object Inspector. I just need to change it in the order to the one listed below:

  TTMSFNCWXBarcodeDecoderType = (bdtCode128, bdtEAN, bdtEAN8, bdtCode39,
    bdtCode39Vin, bdtCodabar, bdtUPC, bdtUPCE, bdtI2Of5, bdt2Of5, bdtCode93,

I will revise the list and give an update here.

Okay. After re-ordering the list, it now works. However, I have to turn the camera off and then on again via: camera.Stop; and Camera.Start;

Is there a work-around for this so that I continuously scan codes without having to shut down the camera off and on every time ?

update.. (it works for Android, but not for Windows)

The scanning works without issues when on mobile devices. I don't have to turn on/off the camera.

However, when compiling for Windows, then it doesn't work unless I turn the camera off and on.

This is the current code I am using to select different BarcodeTypes:

procedure TForm1.cbBarcodeListChange(Sender: TObject);
type  bt= TTMSFNCWXBarcodeDecoderType;
  // set to new BarcodeType;
  bcode.BarcodeType := bt(cbBarcodeList.ItemIndex); 

I don't know why this happens, but I would consider this a bug for Windows.


There is no special settings for Windows, the decoding happens based on camera snapshots. After the camera snapshot is taken it is sent to the decoder library along with the current barcode type setting.

Are you using a TTMSFNCWXCamera for the camera? It could be that the library is having issues properly reading the image taken from the camera because it's low quality. Can you try to increase TTMSFNCWXCamera.Resolution.IdealHeight and IdealWidth, see if t hat improves the reading speed/success?

  1. I forgot to mention that I am using v1.5.2.0 of FNC WX.

  2. I am using the Logitech HD Pro Webcam C290 camera. The last of the true version before they strarted making the cheaper $20 versions out there. It has good quality picture, and is 1920x1080 resolution max. But I've been scanning at the 480x640 resolution.

  3. I am using the standard resolution that is baked in v1.5.2.0, 480x640. As you recall, it does not change the resolution in this version. Maybe that was fixed in v1.5.3.0, which I downloaded today, but have not installed it yet because I am working out other issues in this project and don't want to confuse or introduce potential new issues. I want to wait until I have the database part working in this project before I beging installing v1.5.3.0.

Indeed the resolution issue was fixed in v1.5.3.0. Can you please test this again after updating to v1.5.3.0? If it still does not work properly then, we can investigate further.

Yes, I definitely will.

I'm having another issue that bothers me in v1.5.2.0, where the app won't work in windows unless my wifi is turned on. Either the app freezes or takes a long time to start up and then the camera sometimes shows a message 'not connected' or something like that. But the camera won't turn on unless I turn on wifi. Strange behaviour!! I need to shut my wifi off at times because it slows down my laptop sometimes. Also, i just shut it down if i'm not using it.

I found LibraryLocation: online and offline. I've tried setting it to both but camera won't work unless i turn on wifi under Windows.

How can I resolve it.

Okay. My app will no longer work! Its been shut down. I can't get it to run any more!

I can't go back to rebuilding it. It was so much trouble getting it to work this far.

What happend ???

Are you requesting the available camera devices somewhere? If that is the case, that feature unfortunately only works in online mode due to browser limitations.

That's not easy to tell without context. What did you modify exactly in your project when it stopped working?

I shut down my wifi.

Let me explain..

I don't like wifi on all the time. Only when I am websurfing or watching a youtube video etc.
But I mainly turn it off because my laptop has unusual and suspicious activity with updates and other such tasks running every 5 or 10 minutes, or at random times.

"SoftwareUpdate.exe" is a big no-no to have running, it slows down my system and takes hours to finish. That is a Google product cataloging all my files. Its evil. Every time I remove it, it magically comes back. And there are other suspicious updater scanning type apps that I turn off and they too magically comes back to life. They are unecessary to be running every few hours, let along every day. So I turn off wifi.

okay. that may explain it, LoL.

I will need to by-pass that when compiling under Windows. Yeah, I forgot about that feature, thank you!

This is the section of code causing that issue when I turn off wifi while still developing with the component. I just had to put an Exit; before the code and all is well again while compiling for Windows.

procedure TForm1.camCameraDevicesInitialized(Sender: TObject);
  if cam.Devices.Count > 0 then

procedure TForm1.FormCreate(Sender: TObject);
  cam.CameraType := wctSelected;

Thanks for being so quick to help!

1 Like

And now back to regular programming...

I installed v1.5.3.0. Both install setup.exe's did uninstall the core and the fnc wx pack each.

But unfortunately, I am getting black screen again.

Then, I removed both the two Library files, and added them back (the Java and Web Client files) and recompiled, but I am still getting the same black screen. It is no longer working.

D11.2, Win7, Android 12

Is this the same project as before? Do you also get a black screen in a new project (just for testing purposes)?

Yes, this was the same project as before.

Also, during the install of v1.5.3.0, during the auto-detection of XE7 and D11.2, it appeared to install for XE7 and as well as D11.

But when I load up XE7, during the load up screen it still says v1.5.1.1 Trial and no Registered version. Note, it was doing it for v1.5.2.0 as well (saying v1.5.1.1 Trial), I just didn't realize its importance and forgot to mention it for that version.

But when I load up D11.2, the load up does say: (core (fnc wx

Note, in this installation, there were checkboxes that were auto-check for:
[x] Delphi XE7, [x] c++
[x] Delphi 11 Alexandria [ ] manual

I installed with those setting, even though I do not have the c++ edition. I did the same for v1.5.2.0 though that was successful.

I will try reinstalling it again and see what happens.

D11.2 Professional, Win7, Android 12

Update on the (Installation update for v1.5.3.0) ...

This time, I only checked the box for ([x] Delphi 11), but is still the same issue, a black screen.

D11.2 Professional, Win7, Android 12

Do you also see a black screen in a new sample application or is it just your existing application having this problem?