Loading...
 

CX_PRINTER_MANAGER::SelectPrinterWithPresets

CX_PRINTER_MANAGER::SelectPrinterWithPresets

Description:

This function displays a printer setup dialogue initialised with the parameters passed and returns the printer settings made by the user.

The function expects three objects as parameters: A CX_PRINTER object, a CX_PRINTER_PROPERTIES object and a CX_PAGE_PROPERTIES object. The function can also be called with NULL objects, in which case the default values are displayed.

Returns three transient objects in a vector containing the selected printer (CX_PRINTER) and its properties (CX_PRINTER_PROPERTIES) and the selected paper size (CX_PAGE_PROPERTIES).

If the user cancels the selection dialogue, an empty vector is returned. This can be queried with Cardinality.

This function does not change any settings, especially the default printer is not set. If the selected printers and properties are to be used, the objects must be set explicitly with functions of CXS_DOCUMENT, for example for a document. To select and set the default printer, the command SetPrinter must be used.

Code example:
Var(printer, printerProperties, pageProperties)

// Preset the dialog with landscape paper-format:

CreateTransObject(CX_PAGE_PROPERTIES) -> pageProperties

2 pageProperties Put(paperOrientation)

NULL NULL pageProperties GetManager(PRINTER) Call(SelectPrinterWithPresets) # Dup Cardinality ifnot { Drop return }

0 Over GetElement -> printer 1 Over GetElement -> printerProperties 2 Swap GetElement -> pageProperties

// double number of copies:

printerProperties Copy(copies) 2 * printerProperties Put(copies)

// Show changed values to the user:

printer printerProperties pageProperties GetManager(PRINTER) Call(SelectPrinterWithPresets)

Stack
Stack Positions Object type Brief description
Stack(In) Top CX_PRINTER_MANAGER printer manager
Top 1 CX_PAGE_PROPERTIES Page settings
top 2 CX_PRINTER_PROPERTIES Printer settings
top 3 CX_PRINTER Printers
Stack(Out) Top ]
Top 1 CX_PAGE_PROPERTIES Page settings
top 2 CX_PRINTER_PROPERTIES Printer settings
top 3 CX_PRINTER selected printer
top 4 [
Function call: Call(SelectPrinterWithPresets)