Home Devices

Setting the Tray code or bin code.

edited March 2007 in Devices
Hello.

I want to know how I set the bin code in RB. So far, I saw the property
RBReport.PrinterSetup.Bin but it's read only. The
RBReport.PrinterSetup.BinName is not really usefull since I only have
the bin code in hand (an integer).

Is there any easy way to set it instead of doing something like:

RBReport.PrinterSetup.BinName :=
ppPrinter.PrinterCapabilities.BinNames
[ppPrinter.PrinterCapabilities.Bins.IndexOf(IntToStr(PrinterIndex))];

(I don't know yet if it will work).

Thanks

JFPicard

Comments

  • edited March 2007
    Hello again.

    RBReport.PrinterSetup.BinName := ppPrinter.PrinterCapabilities.BinNames
    [ppPrinter.PrinterCapabilities.Bins.IndexOf(IntToStr(PrinterIndex))];

    Throws an index out of bound(-1). It seems that
    ppPrinter.PrinterCapabilities.Bins.IndexOf(IntToStr(PrinterIndex))
    returns -1 with the real tray code.

    How can I do it then ? I don't want to query the printer to get the name
    corresponding to the tray code that I have.

    Thanks.

    JFPicard

  • edited March 2007

    - ppPrinter returns a global printer. But then you need to specify the
    printer name so that it can get the information about the relevant printer

    - on the other hand Report.Printer will return a reference to a printer
    object whose printer name and printersetup properties reflect those of
    Report.PrinterSetup.

    lPrinter := myReport.Printer;

    - then you can get the printer's list of bin names and bins values like this

    lPrinter.PrinterCapabilities.BinNames[ ] and
    lPrinter.PrinterCapabilities.Bins[ ]

    - in your sample code, you used PrinterIndex - what is that? What you really
    need is the Bin value of interest.

    liBinIndex := lPrinter.PrinterCapabilities.Bins.IndexOf(myBinValue);

    if (liBinIndex >= 0) then
    myReport.PrinterSetup.BinName :=
    lPrinter.PrinterCapabilities.BinNames[liBinIndex];


    Keep in mind that Bins can vary from printer to printer and some printers
    may not used the standard bin values. Also some printers have additional
    paper tray features that do not use the devMode.dmDefaultSource value.



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.