Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ReportTip: Simple Preview Example, Zoom Away
Message
From
16/06/2004 18:22:43
 
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro Beta
Miscellaneous
Thread ID:
00914288
Message ID:
00914481
Views:
11
Now we're talking!!! Very good work. It appears that you just proved that I was wrong. And this makes me happy! Thanks :)


>Folks, I'm not going to waste a lot of time explaining this in text. It should be pretty self-evident.
>
>Suffice to say, learn to use the ReportListener.OutputPage() method and .ListenerType property and you can do pretty much anything you want. You will also see ReportListener.CommandClauses used here, check that out too.
>
>Have fun,
>
>>L<
>
>
>#DEFINE BASEPAGEHEIGHT  550
>#DEFINE BASEPAGEWIDTH 425
>
>CLEAR ALL
>
>ox = NEWOBJECT("rl")
>oy = CREATEOBJECT("form")
>
>WITH oy
>   .ScaleMode = 3
>   .allowOutput = .F.
>   .top = 0
>   .left = 0
>   .height = BASEPAGEHEIGHT
>   .width = BASEPAGEWIDTH
>   .backcolor = RGB(255,255,255)
>   .Show()
>ENDWITH
>
>
>ox.PreviewContainer = oy
>
>REPORT FORM ? OBJECT ox
>
>ox.DoOutputPage(1,1) && 1 corresponds to 100%
>
>WAIT window
>
>ox.DoOutputPage(2, .21123 ) && that's, let's see <g> 21.123%
>
>WAIT window
>
>ox.DoOutputPage(3,2.367) && 236.7% ?
>
>WAIT window
>
>
>DEFINE CLASS rl AS ReportListener
>
>   ListenerType = 3 && like ListenerType 1, but
>                    && the engine won't invoke preview;
>                    && see release notes for more information
>
>   PROCEDURE DoOutputPage(tPage, tMultiplier)
>
>      LOCAL liPage
>
>      IF VARTYPE(tPage) = "N" AND ;
>         BETWEEN(tPage,;
>                 THIS.CommandClauses.RangeFrom, ;
>                 IIF(THIS.CommandClauses.RangeTo=-1, ;
>                     THIS.PageTotal, ;
>                     THIS.CommandClauses.RangeTo))
>         liPage = INT(tPage)
>      ELSE
>         liPage = THIS.CommandClauses.RangeFrom
>      ENDIF
>
>      THIS.SetPreview(tMultiplier)
>
>      THIS.OutputPage(liPage,ThIS.PreviewContainer.MyPreview,2)
>
>   ENDPROC
>
>   PROCEDURE SetPreview(tMultiplier)
>
>      LOCAL liHeight, liWidth
>
>      IF TYPE("THIS.PreviewContainer.MyPreview") # "O"
>
>         THIS.PreviewContainer.AddObject("MyPreview","shape")
>
>      ENDIF
>
>
>      IF VARTYPE(tMultiplier) = "N" AND ;
>         BETWEEN(tMultiplier,.01, 10)
>
>
>         liHeight = BASEPAGEHEIGHT * tMultiplier
>         liWidth  = BASEPAGEWIDTH * tMultiplier
>
>         WAIT WINDOW "H:" + TRANSFORM(liHeight)+ ;
>          ", W:" + TRANSFORM(liWidth) TIMEOUT 1
>
>         * note that Fox will round pixels
>
>         WITH THIS.PreviewContainer
>            .LockScreen = .T.
>            .MyPreview.Height = liHeight
>            .MyPreview.Width = liWidth
>            .Height = liHeight
>            .Width = liWidth
>            .LockScreen = .F.
>            .Cls()
>         ENDWITH
>
>      ENDIF
>
>   ENDPROC
>
>   PROCEDURE Destroy
>      THIS.PreviewContainer = NULL
>   ENDPROC
>
>
>ENDDEFINE
>
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Previous
Reply
Map
View

Click here to load this message in the networking platform