Bug in frxPrinter.pas - setting Bin

Hi, there is a small bug, file frxPrinter.pas, procedure TfrxPrinter.SetPrintParams, line 766/767... Names "FBin" and "ABin" are swapped.

And there sould be simpler way just to set Bin, not by calling that procedure with many parameters.

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 8:19AM
    it would be good if you posted what version or daily build you are using.
  • edited 8:19AM
    Sorry for late reply - email notifications are not working?

    It was 4.6.current (not official). I think that I had same problem with 3.x too (in my old company) - so I don't except changes in frxPrinter.pas at all.
  • edited October 2008
    Please can be this fixed?

    FastReports 4.7.5 - there is not any simple runtime way to set printer bin.

    unit frxPrinter.pas, procedure TfrxPrinter.SetPrintParams
    FMode.dmCopies := ACopies;
    if FBin <> -1 then
      ABin := FBin;
    

    Corrent should be (in my opinion):
    FMode.dmCopies := ACopies;
    if ABin <> -1 then
      FBin := ABin;
    

    AND - please class TfrxCustomPrinter - property Bin: Integer - make it writable. It is really boring to getting and setting another 6 parameters that SetPrintParams needs to just set Bin.

    I need to set bin runtime. It is nice that if I set bin in FRXDesigner then stored value is loaded and used correctly - but I really don't want copy each report with different printer Bin.
  • edited October 2008
    Just for another developers - if you need this and it is not fixed yet:
    unit YourOwnPrintUnit;
    
    ..
    
    implementation
    
    uses
      frxPrinter;
    
    type
      TfrxHackedPrinter = class(TObject)
      private
        FBin: Integer;
      public
        property Bin: Integer read FBin write FBin;
      end;
    
    ..
    var
      PrinterName: string;
      PrinterBin: string;
    begin
      ..
      .. get PrinterName and PrinterBin from your own storage
      ..
      PrintOptions.Printer := PrinterName;
      SelectPrinter;
      frxPrinters.Printer.BinNameToNumber(PrinterBin);
    
      ..
      .. print now...
    end;
    

    Yes, I know - this is ugly, but it is only working way to set Bin runtime in FastReports.
  • edited 8:19AM
    Its 2012 and its still not fixed.....great :angry:" border="0" alt="mad.gif" />" alt=">" />
    DiGi wrote: »
    Just for another developers - if you need this and it is not fixed yet:
    unit YourOwnPrintUnit;
    
    ..
    
    implementation
    
    uses
      frxPrinter;
    
    type
      TfrxHackedPrinter = class(TObject)
      private
        FBin: Integer;
      public
        property Bin: Integer read FBin write FBin;
      end;
    
    ..
    var
      PrinterName: string;
      PrinterBin: string;
    begin
      ..
      .. get PrinterName and PrinterBin from your own storage
      ..
      PrintOptions.Printer := PrinterName;
      SelectPrinter;
      frxPrinters.Printer.BinNameToNumber(PrinterBin);
    
      ..
      .. print now...
    end;
    

    Yes, I know - this is ugly, but it is only working way to set Bin runtime in FastReports.
  • dschuchdschuch Dresden,Germany
    edited 8:19AM
    Hy,

    this code seems to be broken with the latest FR (tested with 4.13 as well as 4.14). In 4.10 everything is working fine.
    Currently we are not sure, but it seems the native function doesn not work too.

    frxPrinters.Printer.SetPrintParams


    Can anyone confirm this?

    We have a code like this:

    FrxReport1.PrepareReport;
    frxReport1.Print; //copie 1
    TfrxHackedPrinter(frxPrinters.Printer).Bin:=bin;
    frxReport1.Print; //copie 2 on another bin

    Daniel.

    OlliWW wrote: »
    Its 2012 and its still not fixed.....great :angry:" border="0" alt="mad.gif" />" alt=">" />
    OlliWW wrote: »
    Just for another developers - if you need this and it is not fixed yet:
    unit YourOwnPrintUnit;
    
    ..
    
    implementation
    
    uses
      frxPrinter;
    
    type
      TfrxHackedPrinter = class(TObject)
      private
        FBin: Integer;
      public
        property Bin: Integer read FBin write FBin;
      end;
    
    ..
    var
      PrinterName: string;
      PrinterBin: string;
    begin
      ..
      .. get PrinterName and PrinterBin from your own storage
      ..
      PrintOptions.Printer := PrinterName;
      SelectPrinter;
      frxPrinters.Printer.BinNameToNumber(PrinterBin);
    
      ..
      .. print now...
    end;
    

    Yes, I know - this is ugly, but it is only working way to set Bin runtime in FastReports.
  • edited 8:19AM
    Check source code, maybe they add some properties before FBin.
  • dschuchdschuch Dresden,Germany
    edited May 2013
    Hm... good idea, sometimes.....

    There are only minor Changes in unit frxPrinter; Most of them are inside Compiler-conditions

    procedure TfrxPrinter.SetPrintParams(APaperSize: Integer;
    has some changes:

    New:
      if ABin = DMBIN_AUTO then
        if FBin <> -1 then
          ABin := FBin
        else
          ABin := DefBin;
    

    Old:
      if FBin <> -1 then
        ABin := FBin;
      if ABin = DMBIN_AUTO then
        ABin := DefBin;
    

    In the new case, ABin is never assigned If ABin is initialized with sth <> DMBIN_AUTO


    We will check out the reason.

    Thanks for the hint.
  • edited 8:19AM
    Still not fixed in FR5 [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> I reported it to FR - Staff 1,5 years ago. I also send them the "correct" code, but no response[/img]>

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.