Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

RB TppCustomBarcode for change default of AutoSize to False

edited June 2008 in General
Dear friends,

I have RB 10.8 pro. and Delphi 7 in windows XP.
I wrote below procedure for change default of images.
I'd like change default of AutoSize to False for Barcode and DBBarcode
and 2Barcode and DB2Barcode.and we can not find TppCustomBarcode or find
TppDBBarcode for this if:
if (lObject is TppCustomImage)
I do not like change source of Delphi of RB because for each new
release I most change source of Delphi!
If RB has not TppCustomBarcode then please add in next release of RB.
/////////////////////////////////////////////////////////////////////////
///////
class procedure TmyReportUtils.SetDefaultImageProperties(aReport:
TppCustomReport);
var
liBand: Integer;
liObject: Integer;
lObject: TppComponent;
begin

for liBand := 0 to aReport.BandCount-1 do

for liObject := 0 to aReport.Bands[liBand].ObjectCount-1 do
begin
lObject := aReport.Bands[liBand].Objects[liObject];

if (lObject is TppCustomImage) then
begin
TppCustomImage(lObject).DirectDraw := True ; // default
DirectDraw to true
TppCustomImage(lObject).Stretch := True ;

if (lObject is TppDBImage) then
begin
TppDBImage(lObject).GraphicType := 'JPEG'; // default
to JPEG
TppDBImage(lObject).MaintainAspectRatio := True ;
end;

end

else if (lObject is TppSubreport) then
SetDefaultImageProperties(TppSubReport
(lObject).Report); // recursive call for childreport
end;
end;
/////////////////////////////////////////////////////////////////////////
///////

Best regards,
Ali Abbasi



--- posted by geoForum on http://delphi.newswhat.com

Comments

  • edited June 2008
    The TppCustomBarCode class is located in the ppBarCod.pas file and is the
    ancestor to TppBarCode and TppDBBarCode. The AutoSize property is a public
    property of the TppPrintable class which is the ancestor to all printable
    components in ReportBuilder. You should be able to do something very
    similar to what you have below using the TppCustomBarCode class.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2008
    Dear Nico,

    Thank you very much for your replay.
    I tested RB has not TppCustomBarcode and TppBarcode and TppDBBarcode and
    Tpp2Barcode and Tpp2DBBarcode.
    And Delphi did show below error:
    [Error] DMUnit.pas(107): Undeclared identifier: 'TppCustomBarCode'
    [Error] DMUnit.pas(107): Operator not applicable to this operand type
    [Fatal Error] LoginUnit.pas(7): Could not compile used unit 'DMUnit.pas'
    Please you tested and I you can please write your codes for me.

    Best regards,

    Ali Abbasi



    the
    public
    printable
    find
    ///
    ///



    --- posted by geoForum on http://delphi.newswhat.com
  • edited June 2008
    Hi Ali,

    Do you have ppBarCod in your uses clause? If you take a look at the
    ppBarCod.pas file located in the \RBuilder\Source\... directory you will see
    that the TppCustomBarCode class is the first class defined.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2008
    Dear Nico,

    I wrote below codes and fixed my problem:

    if (lObject is TppCustomBarCode ) then //uses ppBarCod
    begin
    TppCustomBarCode(lObject).AutoSize := False ;
    TppCustomBarCode(lObject).AutoSizeFont := False ;
    TppCustomBarCode(lObject).Alignment := taCenter ;
    end
    Best regards,

    Ali Abbasi

    will see
    and
    unit 'DMUnit.pas'
    DBBarcode
    RB.
    //
    default
    //



    --- posted by geoForum on http://delphi.newswhat.com
This discussion has been closed.