Data Access Worldwide Knowledge Base
Article ID 2106 Article Title Using WinPrint 1 & 2 in the Same Application - WinPrint Global Object Article URL http://www.dataaccess.com/kbasepublic/kbprint.asp?ArticleID=2106 KBase Category WINPRINT Date Created 04/08/2005 Last Edit Date 02/27/2009
Article Text
Visual DataFlex uses a single global variable that is a handle to either the WinPrint1 global wrapper object or the WinPrint2 global wrapper object. Using a common object handle like this allows the WinPrint commands to be used either with WinPrint 1 or WinPrint 2 report engine.
When you use Visual DataFlex's built-in WinReport classes, this object handle is set automatically to point to the correct global winprint object. This allows you to easily combine WinPrint 1 and WinPrint 2 reports in the same application.
Some users describe problems with applications combining WinPrint 1 & WinPrint 2 reports. This usually happens with users who venture beyond the built-in cWinReport packages to build their WinPrint reports.
If you are having trouble with error message being raised when you try to print a WinPrint 1 report 'after' having just printed a WinPrint 2 report, then the problem is likely to be caused by the global Winprint Object handle still pointing to the WinPrint 2 wrapper. This means that your WinPrint 1 report is trying to get executed by WinPrint 2, thus errors. A solution to this problem is to reset the object handle before printing your WinPrint 1 report. The following code can be used to achieve this...
move oWinPrint to WinPrintID // reset handle to WP1 wrapper.
oWinPrint - is the name of the global WP1 wrapper object
WinPrintID - is the name of the global WP object handle variable
A similar problem can occur with WinPrint 2 reports after printing a WinPrint 1 report. Again, this would only happen when you are not using Visual DataFlex's built-in cWinReport2 classes. In this case you would want to reset the global object handle to point to the WinPrint 2 wrapper as follows...
move ghoWinPrint2 to WinPrintID // reset the handle to WP2 wrapper.
This issue has been discussed several times in the forums. There is now an update to the online help to try to clarify some of the issues.
Look in the online help under: "Reporting | WinPrint 2 | Using WinPrint 2 without the cWinReport Class" for some more information.
Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.
The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.