Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Alignment With Report Listener
Message
De
24/10/2008 21:11:43
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01351025
Message ID:
01357103
Vues:
21
Hi Bo,

Thanks for the feedback. I was hesitant to consider persisting oObjProperties
beyond EvaluateContents out of concern that the native behavior might
protest or insist otherwise.

I haven't really explored the base-code behavior yet. I wonder if simply adding
the Offset prop to oObjProperties on the fly and setting it via a listener would update it
properly on reload?...

-m.

=========================

>Hi Mark,
>
>>Obviously, I can add the necessary props to my lead listener and make sure that they are
>>updated accordingly when any listener updates and reloads oObjProperties. But
>>can anyone suggest a better way for my custom rendering code to access
>>those updated object-property values?
>
>A technique I am using and will eventually implement into the FFC classes is to use BINDEVENTS to hook into the EvaluateContents event and then persist the oObjProperties object onto a Collection of FRX data rows via SCATTER NAME. The oObjProperties object is then available during the Render. I plan to also include helper functions to convert this data into Pen, Brush and Font objects.
>
>Here is some pseudo code that shows how it works:
>
>
>DEFINE CLASS MyRL AS ReportListener
>  oFRX = NULL
>...
>************************************
>FUNCTION BeforeReport( )
>  This.oFRX = CREATEOBJECT("Collection")
>  SET DATASESSION TO (This.FRXDataSession)
>  SELECT frx
>  SCAN
>    SCATTER MEMO NAME loData
>    ADDPROPERTY(loData, "objprop", NULL)
>    This.oFRX.Add(loData)
>  ENDSCAN
>  SET DATASESSION TO (This.DefaultDataSession)
>  BINDEVENT(This, "EvaluateContents", This, "OnEvaluateContents", 1)
>ENDFUNC
>
>************************************
>FUNCTION OnEvaluateContents(nFRXRecNo, oObjProp)
>  IF oObjProp.Reload
>    This.oFRX(nFRXRecno).objprop = oObjProp
>  ELSE
>    This.oFRX(nFRXRecno).objprop = NULL
>  ENDIF
>ENDFUNC
>
>************************************
>FUNCTION Render(nFRXRecNo,.............)
>  loData = This.oFRX(nFRXRecno)
>  IF ISNULL(loData.objprop)
>    lcFont = loData.fontname
>    ...
>  ELSE
>    lcFont = loData.objprop.fontname
>    ...
>  ENDIF
>ENDFUNC
>
>************************************
>FUNCTION AfterReport( )
>  UNBINDEVENT(This, "EvaluateContents", This, "OnEvaluateContents")
>  This.oFRX.Remove(-1)
>ENDFUNC
>...
>
>ENDDEFINE
>
>
>
>Another benefit is that you have NO base class code in the EvaluateContents to slow down your ReportListener. The OnEvaluateContants will only fire if there is code in the EvaluateContents of a parent class or subclass ReportListener.
>
>I will try to post more infromation about this in my blog during the next couple of weeks. But hopefully this will get you started.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform