FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Class Printer
Posts: 1283
Joined: Fri Feb 10, 2006 02:34 PM
Class Printer
Posted: Tue May 31, 2011 02:40 PM
Hi,

If i print this code, i've error in coordenates. Do you know why ?

Code (fw): Select all Collapse
// Printing in portrait and in landscape

#include "fivewin.ch"

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

function Main()
   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
         nColI := 0
         nLinF := 28.5
         nColF := 20.0

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

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

         oPrn:cmSay( 0  ,  0  , "Superior Izquierda (0,0)" , oFont,,CLR_BLACK,,PAD_LEFT  )
         oPrn:cmSay( 0  , 10.5, "Superior Centro (0,10.5)" , oFont,,CLR_BLACK,,PAD_CENTER )
         oPrn:cmSay( 0  , 20.0, "Superior Derecha (0, 20)" , oFont,,CLR_BLACK,,PAD_RIGHT )
         oPrn:cmSay(28.0, 0   , "Inferior Izquierda (28,0)", oFont,,CLR_BLACK,,PAD_LEFT  )
         oPrn:cmSay(28.0, 10.5, "Inferior Centro (28,10.5)", oFont,,CLR_BLACK,,PAD_CENTER )
         oPrn:cmSay(28.0, 20.0, "Inferior Derecha (28,20)" , oFont,,CLR_BLACK,,PAD_RIGHT )
      ENDPAGE
   ENDPRINT

return nil


Compiled with 11.4
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Class Printer
Posted: Tue May 31, 2011 02:48 PM
Try

Code (fw): Select all Collapse
oPrn:Say(oPrn:nVertRes(), oPrn:nHorzRes(), "Inferior Derecha (28,20)" , oFont,,CLR_BLACK,,PAD_RIGHT )


EMG
Posts: 1283
Joined: Fri Feb 10, 2006 02:34 PM
Re: Class Printer
Posted: Wed Jun 01, 2011 07:39 AM

Ciao Enrico,

Grazie per il tip :-). The problem is if i use for example the method ::CmSay() and i want to print exactly in 28,20, when i print it's in 27.6, 19.5. In topic viewtopic.php?f=6&t=21659&p=115222#p115222 are a good solution for this problem (at themoment...).

Grazie Enrico

Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Class Printer
Posted: Wed Jun 01, 2011 10:07 AM

Yes, you have to add the unprintable margin offset.

EMG

Posts: 1283
Joined: Fri Feb 10, 2006 02:34 PM
Re: Class Printer
Posted: Wed Jun 01, 2011 11:50 AM
Ciao Enrico,

I don't know if you have add offset but if you see for example method CmSay you add offset, but the result is wrong...

Code (fw): Select all Collapse
  METHOD CmSay( nRow, nCol, cText, oFont, nWidth, nClrText, nBkMode, nPad, lO2A );
       INLINE ;
       ( ::Cmtr2Pix( @nRow, @nCol ),;
         If( nWidth # Nil, ( ::Cmtr2Pix( 0, @nWidth ), nWidth += ::nYOffset ), nil ),;
         ::Say( nRow, nCol, cText, oFont, nWidth, nClrText, nBkMode, nPad, lO2A ) )


I don't understand nothing de nothing :-)

[EDITED] I'm sorry. Now i see than only add offset if u specified parameter width... But dont undertand...
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
HIX -> https://github.com/carles9000/hix
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Class Printer
Posted: Thu Jun 02, 2011 12:26 AM
Code (fw): Select all Collapse
nWidth += ::nYOffset

Applying offset to width does not appear to make sense.

Even then nYOffset has no relevance to horizontal dimension like width. Probably it was intended to be nXOffset.

What if "nWidth += ::nYOffset" is omitted?
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion