Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ReportTip: Simple Preview Example, Zoom Away
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Titre:
ReportTip: Simple Preview Example, Zoom Away
Divers
Thread ID:
00914288
Message ID:
00914288
Vues:
49
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform