Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Alignment With Report Listener
Message
 
To
24/10/2008 17:19:44
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01351025
Message ID:
01357101
Views:
18
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform