How to get the good barcode with
On the report I have one master data band. On the band there is 1 barcode which has the next name: bar_Artikel.
Before I prepare the report, I set the type of barcode in the delphi code:
Before this code, the barcode has another bartype!
Then I want to get the width of the barcode in a OnBeforePrint event. But I don't get the good width, but I get the width of the barcode before I changed the type.
But I have seen a strange problem. When you double click on the barcode in de designer and then you change some options and presses the OK button, the barcode is updated.
When I use the barcode property of the inspector, I get the same form where I can set some options. But when I presses now the OK button, the barcode is not updated (I mean drawing the barcode with the new options).
So I think here is somewhere the problem.
Does anybody know how I can fix this problem?
Before I prepare the report, I set the type of barcode in the delphi code:
  Barcode := TfrBarCodeView(Report.FindObject('bar_Artikel'));
  Barcode.Param.cBarType := bcCodePostNet;
Before this code, the barcode has another bartype!
Then I want to get the width of the barcode in a OnBeforePrint event. But I don't get the good width, but I get the width of the barcode before I changed the type.
But I have seen a strange problem. When you double click on the barcode in de designer and then you change some options and presses the OK button, the barcode is updated.
When I use the barcode property of the inspector, I get the same form where I can set some options. But when I presses now the OK button, the barcode is not updated (I mean drawing the barcode with the new options).
So I think here is somewhere the problem.
Does anybody know how I can fix this problem?
Comments
barcode centering on a label
since the barcode object does not have its width untill it gets its data
and it doesn't build around it's center point.
we have to modify it on the fly.
This is not perfect but gets close enough
based on a zoom factor of 1
first report must be 2pass
obp event mdband code
begin
recid :=[Table2."Idno"];
// index for array is set
//retrive val from array if on final pass and store in myval
// the value is actually loaded into the array in the script of the
// barcode memo
if finalpass then myval := arrbcw[recid]
else myval:= 0 ;
if finalpass then
begin
if (myval = 1) then bar1.left:= 119;
if (myval > 1) and (myval <7) then bar1.left := (119 - [ROUND((myval*5))]);
if (myval > 6) and (myval <11) then bar1.left := (115 - [ROUND((myval*5))]);
if (myval > 10) and (myval <13) then bar1.left := (110 - [ROUND((myval*5))]);
if (myval > 12) and (myval <15) then bar1.left := (107 - [ROUND((myval*5))]);
if (myval > 14) and (myval <=16) then bar1.left := (104 - [ROUND((myval*5))]);
end
end
script of barcode memo code
// get length of the datastring and store in array
begin
if not finalpass then
arrbcw[recid]:=[LENGTH([Table2."Bcstring"])]
end
or you can rewrite the barcode units code
regards
Each barcode could be a different type and has a different number.
In my program I create an instance of TfrBarcode.
In the OBP event of the barcode I have this code:
The userdefined function GetBarWidth: