Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ReportListener example
Message
De
06/08/2008 16:23:59
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Titre:
ReportListener example
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01337045
Message ID:
01337045
Vues:
97
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.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform