Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Eventhandler() and crystal reports
Message
From
04/02/2002 05:09:40
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Eventhandler() and crystal reports
Miscellaneous
Thread ID:
00614676
Message ID:
00614676
Views:
70
I am using the crystal reports viewer control, and the eventhandler() function to try and handle some of the crystal events.

The eventhandler() function is returning .t. , but my custom code for the events doesn't seem to fire.

I have included the code below, I am paticularly unsure about the newobject/addobject lines, as the eventhandler() function does not accept my object variables, unless I include the newobject lines.


the code defining the class is as follows

do form menu.scx
read events

DEFINE CLASS myclass AS session

IMPLEMENTS _icrviewerevents IN "CRViewer.CRViewer"

PROCEDURE _icrviewerevents_closebuttonclicked(usedefault as varient) AS VARIANT
PROCEDURE _icrviewerevents_clicked(x As Number, y As Number, EventInfo As Varient, UseDefault As Varient) AS VARIANT
PROCEDURE _icrviewerevents_dblclicked(x as number, y as number, eventinfo as varient,usedefault as varient) AS VARIANT
PROCEDURE _icrviewerevents_downloadfinished(loadingtype as varient) AS VARIANT
PROCEDURE _icrviewerevents_downloadstarted(loadingtype as varient) AS VARIANT
PROCEDURE _icrviewerevents_drillondetail(fieldvalues as varient, selectedfieldindex as number,usedefault as varient) AS VARIANT
PROCEDURE _icrviewerevents_drillongraph(pagenumber as Number, x as number, y as number,usedefault as varient) AS VARIANT
PROCEDURE _icrviewerevents_drillongroup(groupnamelist as varient,drilltype as varient,usedefault as varient) AS VARIANT
PROCEDURE _icrviewerevents_drillonsubreport(GroupNameList As Varient, SubreportName As String, Title As String, PageNumber As Number, Index As Number, UseDefault As varient) AS VARIANT

PROCEDURE _icrviewerevents_exportbuttonclicked(usedefault as boolean) AS variant
=MESSAGEBOX('hey')
PROCEDURE _icrviewerevents_firstpagebuttonclicked(usedefault as varient) AS VARIANT
PROCEDURE _icrviewerevents_gotopagenclicked(usedefault as varient,pagenumber as Integer) AS VARIANT
PROCEDURE _icrviewerevents_grouptreebuttonclicked(visible as number) AS VARIANT
PROCEDURE _icrviewerevents_helpbuttonclicked() AS VARIANT
PROCEDURE _icrviewerevents_lastpagebuttonclicked(usedefault as varient) AS VARIANT
PROCEDURE _icrviewerevents_nextpagebuttonclicked(usedefault as varient) AS VARIANT
PROCEDURE _icrviewerevents_onreportsourceerror(errorMsg As String, errorCode As Number, UseDefault As Varient) AS VARIANT
PROCEDURE _icrviewerevents_prevpagebuttonclicked(usedefault as varient) AS VARIANT
PROCEDURE _icrviewerevents_printbuttonclicked(usedefault as varient) AS VARIANT
?"qadgqegefhwhw"
PROCEDURE _icrviewerevents_refreshbuttonclicked(usedefault as varient) AS VARIANT

PROCEDURE _icrviewerevents_searchbuttonclicked(searchtext as string,usedefault as varient) AS VARIANT
PROCEDURE _icrviewerevents_searchexpertbuttonclicked(usedefault as varient) AS VARIANT
PROCEDURE _icrviewerevents_selectionformulabuilt(selectionformula as string, usedefault as varient) AS VARIANT
PROCEDURE _icrviewerevents_selectionformulabuttonclicked(selectionformula as string,usedefault as varient) AS VARIANT
PROCEDURE _icrviewerevents_showgroup(groupnamelist as varient, usedefault as varient) AS VARIANT
PROCEDURE _icrviewerevents_stopbuttonclicked(loadingtype as varient,usedefault as varient) AS VARIANT
PROCEDURE _icrviewerevents_viewchanged(oldViewIndex As Number, newViewIndex As Number) AS VARIANT
PROCEDURE _icrviewerevents_viewchanging(oldViewIndex As Number, newViewIndex As Number) AS VARIANT
PROCEDURE _icrviewerevents_zoomlevelchanged(zoomlevel as number) AS VARIANT


ENDDEFINE



and the code for the form is as follows



*!* If the CRViewer is added to the form, with out any report to preview
*!* Visual FoxPro will give an error stating that the "OLECONTROL may be corrupt"
*!* This has to do with the drawing method of certain types of controls being designed
*!* more specifically for Visual Basic. To get around this add the Smart Viewer
*!* to the form when you want to view the report and preview right away. If the
*!* preview method is not called you will get an error.
crviewer=NEWOBJECT("crviewer.crviewer")
oEvents = NEWOBJECT("myclass")
thisform.AddObject("oEvents","myclass")
thisform.AddObject("CRViewer","olecontrol","CRViewer.CRViewer")

?EVENTHANDLER(crviewer,oEvents)
thisform.windowstate=2
*!* Set the viewer to be the size of the form and visible.
thisform.CRViewer.width = thisform.width
thisform.CRViewer.height = thisform.height
thisform.CRViewer.Visible =.T.
thisform.CRViewer.DisplayGroupTree=.f.
thisform.CRViewer.EnableProgressControl=.t.
thisform.CRViewer.EnableAnimationCtrl=.t.
thisform.CRViewer.EnableGroupTree=.t.
thisform.CRViewer.EnableCloseButton=.t.
thisform.CRViewer.EnableRefreshButton=.f.
thisform.CRViewer.EnableExportButton=.t.
*!* Attach the report to the viewer
thisform.CRViewer.reportsource = CRReport
*!* View the report
thisform.CRViewer.ViewReport
Next
Reply
Map
View

Click here to load this message in the networking platform