Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Systools TStBarCode - code 128 - bug: "Invalid character"



Permlink Replies: 5 - Last Post: Oct 20, 2017 9:45 AM Last Post By: Sigurdur Njardvik Threads: [ Previous | Next ]
Hay Regis

Posts: 3
Registered: 2/18/01
Systools TStBarCode - code 128 - bug: "Invalid character"
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 3, 2016 7:41 AM
Hello,

When I use TStBarCode with the property BarCodeType=bcCode128, I have always this error : Invalid character (C++ Builder 10 Update1 / Systools 4.04)

It was OK with C++ Builder 5 and Systools 4.03.

Thanks.
Régis
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Systools TStBarCode - code 128 - bug: "Invalid character"
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 3, 2016 9:33 AM   in response to: Hay Regis in response to: Hay Regis
Hay wrote:

When I use TStBarCode with the property BarCodeType=bcCode128,
I have always this error : Invalid character (C++ Builder 10 Update1 /
Systools 4.04)

It was OK with C++ Builder 5 and Systools 4.03.

It is likely an Ansi vs Unicode issue. The RTL/VCL was Ansi-based in BCB5,
and is Unicode-based in CB10.x. But without seeing the actual code for Systools,
or the code that is using it, nobody can tell you what is wrong or how to
fix it.

--
Remy Lebeau (TeamB)
Hay Regis

Posts: 3
Registered: 2/18/01
Re: Systools TStBarCode - code 128 - bug: "Invalid character"
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 4, 2016 12:25 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
I installed Systools with "GetIt".
To reproduce the problem, simply put a TStBarCode component on a form and change the property BarCodeType to bcCode128.

Remy Lebeau (TeamB) wrote:
Hay wrote:

When I use TStBarCode with the property BarCodeType=bcCode128,
I have always this error : Invalid character (C++ Builder 10 Update1 /
Systools 4.04)

It was OK with C++ Builder 5 and Systools 4.03.

It is likely an Ansi vs Unicode issue. The RTL/VCL was Ansi-based in BCB5,
and is Unicode-based in CB10.x. But without seeing the actual code for Systools,
or the code that is using it, nobody can tell you what is wrong or how to
fix it.

--
Remy Lebeau (TeamB)
Hay Regis

Posts: 3
Registered: 2/18/01
Re: Systools TStBarCode - code 128 - bug: "Invalid character"
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 4, 2016 1:47 AM   in response to: Hay Regis in response to: Hay Regis
Details of the error in the designer:

[1E8E6B4E]{SysToolsCR230.bpl} StBase.pas.RaiseStError$qqrp17System.TMetaClassi (Line 450, "StBase.pas" + 3) + $3
[1E8E0E4F]{SysToolsCR230.bpl} StBarC.pas.GetACode128ABDigit (Line 1828, "StBarC.pas" + 53) + $A
[1E8E11AA]{SysToolsCR230.bpl} StBarC.pas.GetCode128Digits (Line 1916, "StBarC.pas") + $18
[1E8E18CE]{SysToolsCR230.bpl} StBarC.pas.TStBarCode.GetDigits$qqr20System.UnicodeString (Line 2030, "StBarC.pas" + 103) + $1
[50992E50]{vcl230.bpl } Vcl.Controls.TControl.Perform (Line 7097, "Vcl.Controls.pas" + 1) + $4
[50991812]{vcl230.bpl } Vcl.Controls.TControl.GetTextBuf (Line 6082, "Vcl.Controls.pas" + 0) + $6
[5005A180]{rtl230.bpl } System.@GetMem (Line 4602, "System.pas" + 20) + $0
[5005A19C]{rtl230.bpl } System.@FreeMem (Line 4650, "System.pas" + 20) + $0
[50061DA3]{rtl230.bpl } System.@UStrAsg (Line 25459, "System.pas" + 42) + $0
[1E8DD94A]{SysToolsCR230.bpl} StBarC.pas.TStBarCode.CalcBarCode$qqrv (Line 930, "StBarC.pas") + $6
[5006746D]{rtl230.bpl } System.UnicodeToUtf8 (Line 37685, "System.pas" + 19) + $16
[500627AF]{rtl230.bpl } System.@LStrSetLength (Line 28385, "System.pas" + 25) + $0
[1E8E2085]{SysToolsCR230.bpl} StBarC.pas.TStBarCode.SetBarCodeType$qqr21Stbarc.TStBarCodeType (Line 2221, "StBarC.pas" + 3) + $3
[50128766]{rtl230.bpl } System.TypInfo.SetOrdProp (Line 2792, "System.TypInfo.pas" + 33) + $0
[2118C07A]{designide230.bpl} DesignEditors.TPropertyEditor.SetOrdValue (Line 839, "DesignEditors.pas" + 2) + $E
[2118D1C7]{designide230.bpl} DesignEditors.TEnumProperty.SetValue (Line 1408, "DesignEditors.pas" + 5) + $4
[21382DCB]{vclide230.bpl} IDEInspListBox.TInspListBox.SetPropValue (Line 788, "IDEInspListBox.pas" + 38) + $19
[213843E8]{vclide230.bpl} IDEInspListBox.TInspListBox.ListAccept (Line 1305, "IDEInspListBox.pas" + 6) + $7
[2137A386]{vclide230.bpl} IDEListBtns.TListButton.CloseUp (Line 775, "IDEListBtns.pas" + 14) + $12
[21378F54]{vclide230.bpl} IDEListBtns.TPopupListBox.WMLButtonUp (Line 176, "IDEListBtns.pas" + 2) + $2D
[509931FD]{vcl230.bpl } Vcl.Controls.TControl.WndProc (Line 7249, "Vcl.Controls.pas" + 91) + $6
[0D524BB8]{TrackingSystem230.bpl} TrackingSystemHelp.CBTHookProc (Line 211, "TrackingSystemHelp.pas" + 27) + $F
[5099754B]{vcl230.bpl } Vcl.Controls.TWinControl.IsControlMouseMsg (Line 9842, "Vcl.Controls.pas" + 1) + $9
[50997D3D]{vcl230.bpl } Vcl.Controls.TWinControl.WndProc (Line 10079, "Vcl.Controls.pas" + 158) + $6
[509BBAD9]{vcl230.bpl } Vcl.StdCtrls.TCustomListBox.WndProc (Line 7122, "Vcl.StdCtrls.pas" + 55) + $5
[5099735C]{vcl230.bpl } Vcl.Controls.TWinControl.MainWndProc (Line 9786, "Vcl.Controls.pas" + 3) + $6
[50172214]{rtl230.bpl } System.Classes.StdWndProc (Line 16886, "System.Classes.pas" + 8) + $0
[50ADCB6F]{vcl230.bpl } Vcl.Forms.TApplication.ProcessMessage (Line 10443, "Vcl.Forms.pas" + 23) + $1
[50ADCBB2]{vcl230.bpl } Vcl.Forms.TApplication.HandleMessage (Line 10473, "Vcl.Forms.pas" + 1) + $4
[50ADCEE5]{vcl230.bpl } Vcl.Forms.TApplication.Run (Line 10611, "Vcl.Forms.pas" + 26) + $3
Mikael Lenfors

Posts: 99
Registered: 3/6/01
Re: Systools TStBarCode - code 128 - bug: "Invalid character"
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 15, 2016 3:52 AM   in response to: Hay Regis in response to: Hay Regis
I think this error is because of the following code in CalcBarCode. It inserts some "Start code"= "ˆ" ?

{add start code}
if not CharInSet(C[1], [#136, #137, #138]) then
case FCode128Subset of
csCodeA : C := #136 + C;
csCodeB : C := #137 + C;
csCodeC : C := #138 + C;
end;

When calculating the checkdigit (I think) in GetACode128ABDigit this "Start code" is not recognized and raizes an error!

This has worked before in older versions of TStBarCode but does not work in the GetIt version shipped with Delphi 10.1 Berlin!

Anyone having an idea?

Best regards, Mikael
Sigurdur Njardvik

Posts: 1
Registered: 11/2/00
Re: Systools TStBarCode - code 128 - bug: "Invalid character"
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 20, 2017 9:45 AM   in response to: Hay Regis in response to: Hay Regis
Hay Regis wrote:
Hello,

When I use TStBarCode with the property BarCodeType=bcCode128, I have always this error : Invalid character (C++ Builder 10 Update1 / Systools 4.04)

It was OK with C++ Builder 5 and Systools 4.03.

Thanks.
Régis
Hay Regis wrote:
Hello,

When I use TStBarCode with the property BarCodeType=bcCode128, I have always this error : Invalid character (C++ Builder 10 Update1 / Systools 4.04)

It was OK with C++ Builder 5 and Systools 4.03.

Thanks.
Régis

This is because after the unicode upgrade char now maps to widechar which is unicode not ansichar
therefore the Ord function returns the deccimal valur of a unicode char that may have a different position
and according to http://www.alanwood.net/demos/ansi.html ansi char 136 maps to unicode char 710
to fix this I made the following changes
in procedure procedure TStBarCode.CalcBarCode; of StBarC
        if not CharInSet(C[1], [#136, #137, #138]) then
          case FCode128Subset of
            //csCodeA : C := #136 + C;
            csCodeA : C := #710 + C;
            //csCodeB : C := #137 + C;
            csCodeB : C := #8240 + C;
            //csCodeC : C := #138 + C;
            csCodeC : C := #352 + C;
          end;


and then I added to procedure GetACode128ABDigit
       case Ord(C) of
          130     : bcDigits[bcDigitPos + 1] := 98; {rest are manufactured characters}
          131     : bcDigits[bcDigitPos + 1] := 97;
          132     : bcDigits[bcDigitPos + 1] := 96;
          133     : bcDigits[bcDigitPos + 1] := 98;
          134     : bcDigits[bcDigitPos + 1] := 100;
          135     : bcDigits[bcDigitPos + 1] := 99;
          136     : bcDigits[bcDigitPos + 1] := 103;
          137     : bcDigits[bcDigitPos + 1] := 104;
          138     : bcDigits[bcDigitPos + 1] := 105;
          139     : bcDigits[bcDigitPos + 1] := 106;
          710     : bcDigits[bcDigitPos + 1] := 103;  //ansi 136
          8240    : bcDigits[bcDigitPos + 1] := 104;  //ansi 137
          352     : bcDigits[bcDigitPos + 1] := 105;  //ansi 138
        else
          RaiseStError(EStBarCodeError, stscInvalidCharacter);
        end;
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02