Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ReportListener example
Message
 
 
À
06/08/2008 16:23:59
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01337045
Message ID:
01337183
Vues:
19
Hi Hilmar,

It's not very good example of using a ReportListener. Check Cathy Pountney's article Visual FoxPro 9.0 Report Writer In Action

>I am trying to start learning ReportListener. I found the following sample code:
>
>
>* Example, by Garrett Fitzgerald
>* http://blog.donnael.com/2004/06/vfp9-report-sample/
>
>CREATE CURSOR crsrFontList ( ;
> cFont char(32))
>
>llGotFonts = AFONT(laFonts)
>FOR i = 1 TO ALEN(laFonts)
> INSERT INTO crsrFontList VALUES (laFonts(i))
>ENDFOR
>
>CREATE REPORT fontList FROM DBF("crsrFontList")
>
>loListen = CREATEOBJECT("myFontListener")
>
>REPORT FORM fontList PREVIEW OBJECT loListen
>
>DEFINE CLASS myFontListener as ReportListener
> ListenerType = 1
>
> PROCEDURE EvaluateContents
>  LPARAMETERS nFrxRecno, oObjProperties
>
>  oObjProperties.FontName = ALLTRIM(cFont)
>  oObjProperties.Reload = .T.
> ENDPROC
>ENDDEFINE
>
>
>Now, it is easy to see how an object's .FontName is dynamically changed, and looking at the help file it should also be easy to change additional properties, such as .FontSize or color.
>
>Now my question is, how do I distinguish different objects on a report? This sample report happens to have only one object; but in practice, I may want one particular field, and not all fields, to be bold or red if an amount is negative, for example.
>
>A parameter is passed that indicates the field in the FRX file, but this doesn't seem very practical; it might change if objects are added for example.
>
>TIA,
>
>Hilmar.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform