Data Access Worldwide Knowledge Base

Article ID 2317
Article Title EXAMPLE: Display report in maximized view using cCrystal
Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2317
KBase Category VDF12
Date Created 05/30/2007
Last Edit Date 05/31/2007


Article Text
PROBLEM:
When running a Crystal report to preview in a maximized view in a maximize application, the report would display gray gaps on the right side and/or bottom.

SOLUTION:
This example shows you how to resize the previewer to the size of the client area.

To do that, create a subclass of cCrystalPreview -- cCrystalMaximizedPreview (attached) -- and modify the following:

Class cCrystalMaximizedPreview is a cCrystalPreview
    
    Procedure Construct_Object
        Boolean bAttached
        Handle  hoViewer hoCliArea
        Integer iYX iY iX
        
        Forward Send Construct_Object

        // Display report at 100%
        Set piZoom to 100

        // Get the gui size of the client area
        Get Parent to hoCliArea
        Get GUISize of hoCliArea to iYX
        Move  (hi(iYX)) to iY
        Move (low(iYX)) to iX

        // Set RDC Previewer sizes
        Get phoActiveXReportViewer to hoViewer
        Set GUISize to (iY-2)  (iX-2)
        Send Adjust_Logicals
        Set Size of hoViewer to (Hi(Size(Self))-21) (Low(Size(Self))-6)
    End_Procedure  // Construct_Object
    

    //Displays report in the maximized preview control.
    Procedure DisplayReport Handle hoReport
        Handle hoViewer
        Get phoActiveXReportViewer to hoViewer
        If (hoViewer) Begin
            Set View_Mode of (Self) to Viewmode_Zoom
        End
        Forward Send DisplayReport hoReport
    End_Procedure // DisplayReport

End_Class


To use this new class you will need to use the new package in your RV and set the phcPreviewObject to U_cCrystalMaximizedPreview in your cCrystal object, like:

    Object oCrystalOrderRpt1 is a cCrystal
        Set psReportName to "Orders.rpt"
        Set phcPreviewObject to U_cCrystalMaximizedPreview


The report preview will then use the full screen when the application is maximize and show the scroll bars when the application is not.


Contributed By:
Marcia Booth
Company: Data Access Worldwide
Web Site: http://www.dataaccess.com

Web Links Related to this Article
File cCrystalMaximizedPreview.zip
URL=http://www.dataaccess.com/KBasePublic/Files/2317.cCrystalMaximizedPreview.zip


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.