Data Access Worldwide Knowledge Base

Article ID 2234
Article Title HOWTO: Trap closing of the Crystal Preview Window
Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2234
KBase Category VDF11
Date Created 08/10/2006
Last Edit Date 08/11/2006


Article Text
QUESTION
When you use VDF11.1 RDC to connect to a Crystal XI report and show the results on the screen, there is a preview window. I need to trap the moment the user closes the preview window, either by clicking the X or pressing Ctrl+F4 or using the sysmenu option "close".

ANSWER:
You can do this by creating a subclass of the cCrystalPreview class and adding Deactivating in that class. Then you need to tell the cCrystal object to create the preview window based on your class instead of the standard one. That is done by setting the phcPreviewObject property.

Class code:

    Class cMyCrystalPreviewWindow Is A cCrystalPreview
        Procedure Deactivating
            Send Info_Box "Closing the preview window"
            Forward Send Deactivating
        End_Procedure // Deactivating
    End_Class // cMyCrystalPreviewWindow

Object coding:

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

        Procedure OnInitializeReport Handle hoReport



Contributed By:
Vincent Oorsprong
Company: Data Access Worldwide
email: vincent.oorsprong@dataaccess.eu
Web Site: http://www.dataaccess.eu


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.