Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling Printers using Aliases

Status
Not open for further replies.

SercoSteve

Programmer
Sep 25, 2002
44
GB
Is it possible to send data to a printer defined with an ALIAS?

Regards

Steve

 
Steve,

Not in any way I can think of, as printers aren't stored in directories (which is the type of shortcut aliases are generally designed to support).

Now, you can use variables to control the printer used for reports. To do that, though, you need to devise a mechanism for storing the name of the printer driver and then add code to implement that mechanism.

In the past, I've done this by predefining a set of supported report destinations and then creating custom methods in a library that handle the needs of each supported destination.

To illustrate, here's a chunk of code from one such library method:

Code:
	if loRetval then

      switch

         case strRptDest = "Screen" :

            roiOutput.Name = strRptName
            If loAnswer then
               roiOutput.MasterTable = ":PRIV:ANSWER"
            endIf
            roiOutput.WinStyle = winStyleDefault +
                                 winStyleMaximize +
                                 winStyleHScroll +
                                 winStyleVScroll
            loRetval = reportPreview( roiOutput )

         case strRptDest = "Printer" :

            rpiOutput.Name = strRptName
            rpiOutput.Orient = siOrient
            If loAnswer then
               rpiOutput.MasterTable = ":PRIV:ANSWER"
            endIf
            loRetval = reportPrint( rpiOutput )

         case strRptDest = "Publish" :

            roiOutput.Name = strRptName
            If loAnswer then
               roiOutput.MasterTable = ":PRIV:ANSWER"
            endIf
            roiOutput.WinStyle = winStyleDefault + winStyleMinimize
            loRetval = reportPublish( roiOutput )

         case strRptDest = "File" :

            roiOutput.Name = strRptName
            If loAnswer then
               roiOutput.MasterTable = ":PRIV:ANSWER"
            endIf
            roiOutput.WinStyle = winStyleDefault + winStyleMinimize
            loRetval = reportExportFile( roiOutput )

         otherwise :

            msgStop( "Can't Run Report",
                     "Reason: The destination you chose (" +
                     strRptDest + ") is not currently " +
                     "supported.  Please make sure the " +
                     "reportHandler() library function is " +
                     "updated accordingly." )
            loRetval = FALSE

      endSwitch
   endIf

In this example, you see that the application supports four separate destinations. Each branch of the case statement then calls code appropriate for that destination.

This code, by the way, isn't complete. The complete code is too long to post. Nevertheless, I hope it demonstrates the underlying idea.

I know it seems a bit of work to setup, but once you've done it, you can reuse that in any Paradox application.

Hope this helps...

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top