Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ReportTip: Simple Preview Example, Zoom Away
Message
De
16/06/2004 13:16:09
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Divers
Thread ID:
00914288
Message ID:
00914338
Vues:
9
Hello Lisa.

Very nice program to change the zoom. Here is another approach which would allow you to change the preview zoom menu to a drop-down-combo or simular with custom zoom values and plent of other possibilities.

You modify at design time and update the Zoom Array at run time.

in the init() of the FrxPreviewForm in the FrxPreview.vcx change the following:
* *** old
* *** dimension THIS.zoomLevels[10,3]
* *** new
dimension THIS.zoomLevels[11,3]

* *** ...
THIS.zoomLevels[10,ZOOM_LEVEL_PROMPT] = "Custom"
THIS.zoomLevels[11,ZOOM_LEVEL_PROMPT] = ZOOM_LEVEL_PROMPT_WHOLE_PAGE_LOC

* *** ...
THIS.zoomLevels[10,ZOOM_LEVEL_PERCENT] =   5 && or any predifined zoom value
THIS.zoomLevels[11,ZOOM_LEVEL_PERCENT] =   -1  

* *** ...
THIS.zoomLevels[10,ZOOM_LEVEL_CANVAS] =    1
THIS.zoomLevels[11,ZOOM_LEVEL_CANVAS] =    1
recomile the project as an app to the vfp folder.

you could then either predefine the zoom in the 'custom' row with a textbox or spinner or simular

or, when you call a report like this
olistener = NEWOBJECT("XMLListener", HOME(0)+"ffc\_reportlistener.vcx")
olistener.ListenerType=1
REPORT form "c:\program files\microsoft visual foxpro 9\samples\solution\reports\colors.frx" ;
   OBJECT olistener nowait

* *** to change to the new custom zoom
olistener.PreviewContainer.oForm.zoomLevels(10,2) = 25

* *** actionSetZoom() will only update/recalculate if the para passed is different 
* *** then last time it was called. this could easely be changed in actionSetZoom()
olistener.PreviewContainer.oForm.actionSetZoom( 10 ) 
>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
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform