At 03:48 PM 3/23/2005, Marc Shluter wrote:
I was wondering... is there a better way besides using
a bunch of Choose statements.
I do not think I will need all of the options we have
with 7.1, mostly Printer, LPT1, Screen, PDF, File and
maybe another one down the road.
Marc,
Use the (CVAL('Printers')) and (CVAL('WindowsPrinter'))
functions to automate the entire process.
Here's how:
-- Start
{
PickPrinter.RMD to provide the option of selecting
appropriate printer as well as the option to print
on SCREEN.
Author: A. Razzak Memon
Created: March 18, 2003
Last Update: March 23, 2005
}
SET VAR vAvailablePrinters TEXT = NULL
SET VAR vPick TEXT = NULL
SET VAR vDefaultPrinter TEXT = NULL
SET VAR vAvailablePrinters = ((CVAL('Printers'))+',Screen')
SET VAR vDefaultPrinter = (CVAL('WindowsPrinter'))
CLS
CHOOSE vPick FROM #LIST .vAvailablePrinters +
CHKBOX 1 TITLE 'Select Appropriate Printer' +
CAPTION 'Available Printers' LINES 10 FORMATTED +
OPTION LIST_FONT_COLOR WHITE +
|LIST_BACK_COLOR TEAL +
|TITLE_FONT_COLOR RED +
|TITLE_BACK_COLOR WHITE +
|WINDOW_BACK_COLOR WHITE +
|TITLE_FONT_NAME VERDANA +
|TITLE_FONT_SIZE 10 +
|TITLE_BOLD ON +
|WINDOW_CAPTION +
|BUTTONS_BACK_COLOR WHITE +
|BUTTONS_SHOW_GLYPH ON
IF vPick IS NULL OR vPick = '[Esc]' THEN
GOTO Done
ENDIF
IF vPick = 'Screen' THEN
PRINT ReportName WHERE .. ORDER BY .. +
OPTION SCREEN|WINDOW_STATE MAXIMIZED
GOTO Done
ELSE
PRNSETUP .vPick
PRINT ReportName WHERE .. ORDER BY .. +
OPTION PRINTER
PRNSETUP .vDefaultPrinter
ENDIF
LABEL Done
CLEAR VAR vAvailablePrinters, vPick, vDefaultPrinter
RETURN
-- End
Enjoy and make sure to have fun!
Very Best R:egards,
Razzak.