Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Report Listener and Paint()
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01265663
Message ID:
01265733
Views:
14
>I have been using Report Listener object with Paint() method in order to control report
>Preview. I am not sure if I have it designed correctly but it has never looked to me as
>a right solution using Paint() to begin with. My question: are there any changes in SP2
>to the report preview controling mechanism?

I'm not sure why you're using Paint(). I put together a short sample a while ago to see how to make it work -- it's probably not optimal, but it was good enough for my purposes at the time.
*!* Create a quick report
USE home(1) + "labels"
create report labels from labels

*!* Show the preview form
oForm = CREATEOBJECT("frmPreview")
oForm.Show()

*!* Add a shape for the actual preview
oForm.AddObject("shpPreview", "Shape")
WITH oForm.shpPreview as Shape
    .Height = 550 && get the proportions correct
    .Width = 425  && for 8.5x11
.Visible = .T.
ENDWITH

*!* Create a preview listener
oPreview = CREATEOBJECT("ReportListener")
oPreview.ListenerType = 3
oPreview.PreviewContainer = oForm

*!* Run the report. Nothing will display, since that's
*!* the listener type we chose above.
REPORT FORM labels OBJECT oPreview
DoSleep(2)

*!* Output the page at the current zoom level (smaller
*!* than 100, but I haven't computed the exact value)
oPreview.OutputPage(1, oForm.shpPreview, 2)
MESSAGEBOX("Hit OK to continue")

*!* Make the preview shape 4 times bigger...
oForm.shpPreview.Height = oForm.shpPreview.Height * 4
oForm.shpPreview.Width = oForm.shpPreview.Width * 4
DoSleep(.1)

*!* ...and re-render the preview.
oPreview.OutputPage(1, oForm.shpPreview, 2)

MESSAGEBOX("Hit OK to close")

oForm.Release()

*!* Wait for any needed windows events to get through
PROCEDURE DoSleep

LPARAMETERS tnSeconds
LOCAL lnSeconds

lnSeconds = SECONDS()
DO WHILE SECONDS() - lnSeconds < tnSeconds
    DOEVENTS
ENDDO

DEFINE CLASS frmPreview as Form
    AllowOutput = .F.
    WindowState = 2

    PROCEDURE Release
        oPreview.PreviewContainer = .NULL.
    ENDPROC
ENDDEFINE
My blog
My consulting page
My home page

Member of the Trim Your Auto-Quote Campaign!
What's another word for thesaurus?
Previous
Reply
Map
View

Click here to load this message in the networking platform