Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing pictures at runtime
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Crystal Reports
Titre:
Changing pictures at runtime
Divers
Thread ID:
00827584
Message ID:
00827584
Vues:
84
There seems to be some timing issue with the following code, which SHOULD alter the contents of a picture on the report at runtime. If I use the debugger and single step this, it works fine. But putting WAIT WINDOWs in various paces as not helped. It DOES work perfectly if the image is contained in one of the first 3 detail sections, such as Da, Db, or Dc. Move the picture to Dd, De, or higher and it fails. No errors are produced, and putting in a WAIT WINDOW in the even code shows that, even though the picture is not changed, the event code fires!
VFP 7 SP1, CR8.

Randy

LOCAL oCR AS CRAXDRT.Application
LOCAL oRpt AS CRAXDRT.Report
LOCAL oDB AS CRAXDRT.Database
LOCAL ocDBT AS CRAXDRT.DatabaseTables
LOCAL oDBT AS CRAXDRT.DatabaseTable
LOCAL oSECT AS CRAXDRT.Section

crReport = "C:\REPORTS\REPORT1.RPT"
oCR = CREATEOBJECT("CrystalRuntime.Application")
oRpt = oCR.OpenReport("C:\report\report1.rpt")
oSECT = oRPT.Sections('De')

* Setup the event binding
oEvents = CREATEOBJECT("CrystalEvents", oSECT)
EVENTHANDLER(oSECT, oEvents)
oRpt.PrinterSetup(0)
DO FORM vw_cryst
WITH vw_cryst
.caption = "Crystal Reports"
.addobject('crviewer1','olecontrol','crviewer.crviewer')
WITH .crViewer1
.height=vw_cryst.height
.width=vw_cryst.width
.visible=.t.
.EnableRefreshButton = .F.
.EnableGroupTree = .F.
.DisplayGroupTree = .F.
.reportsource=oRpt
.ViewReport
=MESSAGEBOX("Processing completed. You may view the report, or you may print from the preview window.")
ENDWITH
ENDWITH

EVENTHANDLER(oSECT,oEvents,.T.)


DEFINE CLASS CrystalEvents AS session OLEPUBLIC
IMPLEMENTS ISectionEvent IN "CrystalRuntime.Application"

oSection = NULL

PROCEDURE Init(toSection AS Object) AS Boolean
This.oSection = toSection
ENDPROC

PROCEDURE ISectionEvent_format(pFormattingInfo as Variant) AS VOID;
HELPSTRING "Fires this event before starting to format a section"

LOCAL loSection, loFileName, loPicture

loSection = This.oSection
loPicture = loSection.ReportObjects('Picture1')
loPicture.FormattedPicture = LOADPICTURE('C:\report\pic1.bmp')

ENDPROC

ENDDEFINE
Répondre
Fil
Voir

Click here to load this message in the networking platform