Page 3 of 3

Re: Clase TDirectPrint

PostPosted: Wed Feb 20, 2013 8:20 pm
by acuellar
Gracias William

Saludos,

Adhemar

Re: Clase TDirectPrint

PostPosted: Thu Feb 21, 2013 11:57 pm
by Soft-Javi
hola

mes sumo a los comentario de rafa,

aunque despues de 2 AÑOS se envia :-(, que lastima

bye

Re: Clase TDirectPrint

PostPosted: Fri Feb 22, 2013 2:50 am
by Antonio Linares
Más vale tarde que nunca... :-)

Re: Clase TDirectPrint

PostPosted: Fri Feb 22, 2013 7:46 am
by Soft-Javi
hola
claro mas vale tarde que nunca,

pero creo que ya todos los foreros sabemos que no podemos
utilizar dichas lib por los continuos cambios de mejoramientos de (x)harbour y su PCODE

por eso quedo sin comentarios durante 2 años que podrian ser mucho mas provechoso

Re: Clase TDirectPrint

PostPosted: Fri Feb 22, 2013 10:26 am
by Antonio Linares
Lo bueno es que como William ha proporcionado su codigo fuente, no hay problema en recompilarla con nuevas versiones de Harbour :-)

Re: Clase TDirectPrint

PostPosted: Fri Feb 22, 2013 9:51 pm
by sysctrl2
Viendo un poquito la class tDirecPrint,

deberia de funcionar con el siguiente ejemplo,

ya nos dira el buen amigo william,

saludos..

Code: Select all  Expand view
#include <fivewin.ch>

function Main()
   local oPrn
   local i
   local nRow := 1
   local nPagina := 1
   
   oPrn := TDirectPrint():New('lpt1')
   
   oPrn:beginprint()
   
   for i := 1 to 330
      if nRow = 1
         oPrn:bold( .t. )
         oPrn:normal()
         oPrn:say( nRow, 10, 'Codigo' )  
         oPrn:say( nRow, 60, 'Pagina:' + cstr(nPagina) )
         oPrn:bold( .f. )
         oPrn:condensed()
         nRow++
      endif
      oPrn:say( nRow, 10, cstr(i) )
      nRow ++
      if nRow >= 55
         oPrn:eject()
         nRow := 1
         nPagina ++
      endif
   next
   oPrn:endprint()
return nil

FUNCTION WCStr( xExp, nDecimals )

   LOCAL cType

   IF xExp == NIL
      RETURN 'NIL'
   ENDIF

   cType := ValType( xExp )

   SWITCH cType
      CASE 'C'
         RETURN xExp

      CASE 'D'
         RETURN dToS( xExp )

      CASE 'L'
         RETURN IIF( xExp, '.T.', '.F.' )

      CASE 'N'
         IF !HB_IsNil( nDecimals )
            RETURN AllTrim(Str( xExp, 11, nDecimals ))
         ELSE
            RETURN AllTrim(Str( xExp ))
         ENDIF

      CASE 'A'
         RETURN "{ Array of " +  LTrim( Str( Len( xExp ) ) ) + " Items }"

      CASE 'B'
         RETURN '{|| Block }'

      CASE 'O'
         RETURN "{ " + xExp:ClassName() + " Object }"

      CASE 'P'
         RETURN NumToHex( xExp )

      CASE 'H'
         RETURN "{ Hash of " +  LTrim( Str( Len( xExp ) ) ) + " Items }"

      DEFAULT
         RETURN "Type: " + cType
   END

RETURN ""


#include "wtraw.prg"

Re: Clase TDirectPrint

PostPosted: Mon Feb 25, 2013 7:07 pm
by karinha
sysctrl2 wrote:Viendo un poquito la class tDirecPrint,

deberia de funcionar con el siguiente ejemplo,

ya nos dira el buen amigo william,

saludos..

Code: Select all  Expand view
#include <fivewin.ch>

function Main()
   local oPrn
   local i
   local nRow := 1
   local nPagina := 1
   
   oPrn := TDirectPrint():New('lpt1')
   
   oPrn:beginprint()
   
   for i := 1 to 330
      if nRow = 1
         oPrn:bold( .t. )
         oPrn:normal()
         oPrn:say( nRow, 10, 'Codigo' )  
         oPrn:say( nRow, 60, 'Pagina:' + cstr(nPagina) )
         oPrn:bold( .f. )
         oPrn:condensed()
         nRow++
      endif
      oPrn:say( nRow, 10, cstr(i) )
      nRow ++
      if nRow >= 55
         oPrn:eject()
         nRow := 1
         nPagina ++
      endif
   next
   oPrn:endprint()
return nil

FUNCTION WCStr( xExp, nDecimals )

   LOCAL cType

   IF xExp == NIL
      RETURN 'NIL'
   ENDIF

   cType := ValType( xExp )

   SWITCH cType
      CASE 'C'
         RETURN xExp

      CASE 'D'
         RETURN dToS( xExp )

      CASE 'L'
         RETURN IIF( xExp, '.T.', '.F.' )

      CASE 'N'
         IF !HB_IsNil( nDecimals )
            RETURN AllTrim(Str( xExp, 11, nDecimals ))
         ELSE
            RETURN AllTrim(Str( xExp ))
         ENDIF

      CASE 'A'
         RETURN "{ Array of " +  LTrim( Str( Len( xExp ) ) ) + " Items }"

      CASE 'B'
         RETURN '{|| Block }'

      CASE 'O'
         RETURN "{ " + xExp:ClassName() + " Object }"

      CASE 'P'
         RETURN NumToHex( xExp )

      CASE 'H'
         RETURN "{ Hash of " +  LTrim( Str( Len( xExp ) ) ) + " Items }"

      DEFAULT
         RETURN "Type: " + cType
   END

RETURN ""


#include "wtraw.prg"



Cesar, y en un puerto USB con una impresora matricial?

Gracias, saludos.