FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Seleccionar número copias en el preview
Posts: 1816
Joined: Wed Oct 26, 2005 02:49 PM
Seleccionar número copias en el preview
Posted: Fri Nov 12, 2021 07:49 PM
Hola buenas tardes para todos

No se si es posible colocar en la barra del preview (rpreview.prg) un get o un combobox para que el usuario desde la previsualización, pueda seleccionar el numero de copias a imprimir.



Code (fw): Select all Collapse
// Sample showing how to manage the printer object

#include "FiveWin.ch"

static oWnd

//----------------------------------------------------------------------------//

function Main()

   local oPrn, oFont
   local nRowStep, nColStep
   local nRow := 0, nCol := 0, n, m

   // PrnSetSize( 2100, 1200 )     To adjust a different printer paper size!

   PRINT oPrn NAME "Testing the printer object from FiveWin" PREVIEW

      if Empty( oPrn:hDC )
         return nil          // Printer was not installed or ready
      endif

      DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -12 OF oPrn

      nRowStep = oPrn:nVertRes() / 20   // We want 20 rows
      nColStep = oPrn:nHorzRes() / 15   // We want 15 cols

      PAGE
         oPrn:SayBitmap( 1, 1, "..\bitmaps\fivewin.bmp" )
         for n = 1 to 20  // rows
             nCol = 0
             oPrn:Say( nRow, nCol, Str( n, 2 ), oFont )
             nCol += nColStep
             for m = 1 to 15
                oPrn:Say( nRow, nCol, "+", oFont )
                nCol += nColStep
             next
             nRow += nRowStep
         next
         oPrn:Line( 0, 0, nRow, nCol )
      ENDPAGE

      PAGE
         nRow = 0
         oPrn:SayBitmap( 1, 1, "..\bitmaps\fivewin.bmp" )
         for n = 1 to 20  // rows
             nCol = 0
             oPrn:Say( nRow, nCol, Str( n + 20, 2 ), oFont )
             nCol += nColStep
             for m = 1 to 15
                oPrn:Say( nRow, nCol, "+", oFont )
                nCol += nColStep
             next
             nRow += nRowStep
         next
         oPrn:Line( 0, 0, nRow, nCol )
      ENDPAGE

   ENDPRINT

   oFont:End()      // Destroy the font object

return nil

//----------------------------------------------------------------------------//

procedure AppSys  // XBase++ requirement

return

//----------------------------------------------------------------------------//
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Seleccionar número copias en el preview
Posted: Fri Nov 12, 2021 10:42 PM
Simples, ponga en el diálogo, asi:

Code (fw): Select all Collapse
#include "FiveWin.ch"

#define PAD_LEFT            0
#define PAD_RIGHT           1
#define PAD_CENTER          2

static oWnd

MEMVAR nCopias

function Main()

   nCopias   := 5  // ponga en el dialogo Number of copies.

   DEFINE WINDOW oWnd FROM 1, 1 TO 20, 60 TITLE "Printing a Window"

   @ 3, 3 BUTTON "&Print me" OF oWnd SIZE 80, 20 ;
      ACTION PrintMe_Copias()

   ACTIVATE WINDOW oWnd

return nil

FUNCTION PrintMe_Copias()

   LOCAL nI

   FOR nI := 1 TO nCopias

      SYSREFRESH()

      PrintMe()

   NEXT

RETURN NIL

function PrintMe()

   local oPrn, oFont, oPen
   Local nLinI, nColI, nLinF, nColF

   PRINT oPrn NAME "Impresión en Vertical.." // PREVIEW

      DEFINE FONT oFont NAME "Arial" SIZE 0, -10 BOLD OF oPrn
      DEFINE PEN oPen WIDTH  2                        OF oPrn
 
      oPrn:SetPage(9)    // A4
      oPrn:SetPortrait() // Vertical

      PAGE

         nLinI :=  0.90
         nColI :=  0.90
         nLinF := 28.6
         nColF := 20.0

         oPrn:Cmtr2Pix(@nLinI, @nColI)
         oPrn:cmtr2Pix(@nLinF, @nColF)

         oPrn:Box(nLinI, nColI, nLinF, nColF, oPen  )

         oPrn:cmSay( 1.0,  1.0, "Superior Izquierda", oFont,,CLR_BLACK,,PAD_LEFT  )

         oPrn:cmSay( 1.0, 10.5, "Superior Centro",    oFont,,CLR_BLACK,,PAD_CENTER )

         oPrn:cmSay( 1.0, 20.0, "Superior Derecha",   oFont,,CLR_BLACK,,PAD_RIGHT )

         oPrn:cmSay(28.0,  1.0, "Inferior Izquierda", oFont,,CLR_BLACK,,PAD_LEFT  )

         oPrn:cmSay(28.0, 10.5, "Inferior Centro",    oFont,,CLR_BLACK,,PAD_CENTER )

         oPrn:cmSay(28.0, 20.0, "Inferior Derecha",   oFont,,CLR_BLACK,,PAD_RIGHT )

      ENDPAGE

   ENDPRINT

   oFont:End()

return nil


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion