open

open(): Integer updating;

The open method of the CMDPrint class initiates the common Print dialog for the CMDPrint class and returns a value indicating the success of the user actions, as listed in the following table.

Value Description
0 User clicked the OK button. Values of the selections made are returned.
1 User clicked the Cancel button.
Other Windows error number indicating a fault associated with the execution of the dialog.

The position of the displayed Print dialog cannot be determined. The values of the variable options for the class should be set before the open method is used.

The following example shows the use of the open method to open a common Print dialog.

vars
    cmdPrint : CMDPrint;
begin
    create cmdPrint;
    if cmdPrint.open = 0 then              // not cancelled and no error
        str := cmdPrint.printerName;       // use returned value
    endif;
epilog
    delete cmdPrint;                       // tidy
end;

Any values that are returned are retained if further calls are made on the class instance. The object should be deleted when it is no longer required.

An exception is raised if this method is invoked from a server method.

When a printer is about to be opened and the previously used printer name is no longer valid, the following log message is written and the current default printer is used instead.

Printer name is no longer valid: printer-name - selecting default printer

If the default printer is used, JADE does not retain the printer name between print jobs. If you change the default printer, the next print job to the default printer is output to a different (the new default) printer. If you have changed the default printer and you want to output the job to the earlier printer, specify the actual printer name.