Printer class question - RESOLVED

Printer class question - RESOLVED

Postby Silvio.Falconi » Tue Oct 20, 2020 9:11 am

I wanted to know if there was a function in the printer class that would automatically print a text and a box for example:

Image

coordinates are

first text
x 1
y 5.5
width 4.5
height 0.8

Box very fine black colour gray color background

Font Arial 6

Left alignment top position


second text
x 1
y 5.5
width 4.5
height 0.8

Font Arial 12
Bottom position centered alignment


I tried with

CmSay( nRow, nCol, cText, oFont, nWidth, nClrText, nBkMode, nPad, lO2A )
but it's no god

Code: Select all  Expand view
#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 "TEST...." PREVIEW
   DEFINE FONT oFont NAME "Arial" SIZE 0, -6  OF oPrn
   DEFINE FONT oFont2 NAME "Arial" SIZE 0, -12  OF oPrn

   DEFINE PEN oPen WIDTH  1        OF oPrn

      oPrn:SetPage(9)  // A4
      oPrn:SetPortrait() //Vertical
      PAGE


         nLinI :=  1.00
         nColI :=  5.5
         nLinF :=  0.8
         nColF :=  4.5
         oPrn:Box(nLinI, nColI, nLinF, nColF, oPen, CLR_GRAY,,"CM" )

         oPrn:cmSay( 1, 5.5, "Tipo documento", oFont,4.5,CLR_BLACK,,PAD_LEFT  )
         oPrn:cmSay(1,5.5, "DESCRIZIONE DOCUMENTO", oFont2,4.5,CLR_BLACK,,PAD_CENTER  )

         ENDPAGE
   ENDPRINT




return nil
 


My result
Image
Last edited by Silvio.Falconi on Fri Oct 23, 2020 2:42 pm, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: Printer class question

Postby Silvio.Falconi » Tue Oct 20, 2020 10:35 am

METHOD Box( nTop, nLeft, nBottom, nRight, ;
[Pen], ; // oPen/hPen/nColor/{nColor,nThickness}
[Brush], ; // nColor / oBrush
[aText], ; // { cText, oFont, nColor } Painted in center
cUnits ; // "CM", "MM", "INCHES"
)

I tried to use aText array but I can set only { cText, oFont, nColor } and it was printed in center
How I can to print it with align ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: Printer class question

Postby karinha » Tue Oct 20, 2020 12:41 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7794
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Printer class question

Postby karinha » Tue Oct 20, 2020 12:46 pm

Code: Select all  Expand view

// \samples\SILVIORL.PRG - 20/10/2020 - kapiabafwh@gmail.com

#include "fivewin.ch"

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

FUNCTION Imp_Silvio()

   LOCAL oPrn, oFont, oFont2, oFont3, oPen, oPen1, oPen2, oPen3, cFiveWin
   LOCAL nLinI, nColI, nLinF, nColF
   LOCAL ResLinha, ResColuna, nLinha, nColuna

   PRINT oPrn NAME "TEST SILVIO..." PREVIEW

      DEFINE FONT oFont  NAME "Arial" SIZE 0, - 6  BOLD           OF oPrn
      DEFINE FONT oFont2 NAME "Arial" SIZE 0, - 12 BOLD Underline OF oPrn
      DEFINE FONT oFont3 NAME "Arial" SIZE 0, - 18 BOLD           OF oPrn

      DEFINE PEN oPen WIDTH  1        OF oPrn
      DEFINE PEN oPen1 WIDTH 4 COLOR CLR_BLACK                    OF oPrn
      DEFINE PEN oPen2 WIDTH 2 COLOR CLR_BLACK                    OF oPrn
      DEFINE PEN oPen3 WIDTH 5 COLOR CLR_BLACK                    OF oPrn

      oPrn:SetPage( 9 )  // A4
      oPrn:SetPortrait() //Vertical

      ResLinha  := oPrn:nLogPixely() / 2.54
      ResColuna := oPrn:nLogPixelx() / 2.54

      PAGE

         nLinI :=  1.00
         nColI :=  5.5
         nLinF :=  0.8
         nColF :=  4.5

         nLinha  := nLinI
         nColuna := nColI

        // oPrn:Box( nLinI, nColI, nLinF, nColF, oPen, CLR_GRAY, , "CM" )

        // oPrn:cmSay( 1, 5.5, "Tipo documento", oFont, 4.5, CLR_BLACK, , PAD_LEFT  )
        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + "Tipo documento:", oFont,, CLR_BLACK,, PAD_LEFT )


        //oPrn:cmSay( 1, 5.5, "DESCRIZIONE DOCUMENTO", oFont2, 4.5, CLR_BLACK, , PAD_CENTER  )

        nColuna := 10.5

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + "DESCRIZIONE DOCUMENTO", oFont2,, CLR_BLACK,, PAD_CENTER )

        nLinha  := nLinha += .80
        nColuna :=  5.0

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + "ESCHOOL: SILVIO FALCONI JUVENILE", oFont2,, CLR_BLACK,, PAD_CENTER )

        nLinha  := nLinha += .80
        nColuna :=  9.50

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + "ESCHOOL: FIVEWIN BRASIL THE BEST", oFont3,, CLR_BLACK,, PAD_CENTER )

        nLinha  := nLinha += .80
        nColuna := 16.50

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + "kapiabafwh@gmail.com", oFont,, CLR_BLACK,, PAD_LEFT )

        nLinha  := nLinha += .50
        nColuna := 13.50

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + "Joao Santos: I Love FiveWin", oFont,, CLR_BLACK,, PAD_LEFT )

        nLinha  := nLinha += .50
        nColuna :=  5.50

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + "Mira se sirve Silvio Falconi", oFont,, CLR_BLACK,, PAD_LEFT )

        nLinha  := nLinha += .50
        nColuna :=  3.50

        cFiveWin := "FiveWin is easy, it's the people who complicate it."

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + cFiveWin, oFont2,, CLR_BLACK,, PAD_LEFT )

        nLinha  := nLinha += 1.00
        nColuna := 14.50

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + "By Silvio Falconi: de Italia.", oFont2,, CLR_BLACK,, PAD_LEFT )

      ENDPAGE

   ENDPRINT

   oPen:End()
   oPen1:End()
   oPen2:End()
   oPen3:End()

   oFont:End()
   oFont2:End()
   oFont3:End()

RETURN NIL
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7794
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Printer class question

Postby karinha » Tue Oct 20, 2020 4:29 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7794
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Printer class question

Postby karinha » Tue Oct 20, 2020 4:32 pm

BOX... BOX... BOX.

Code: Select all  Expand view

// \samples\SILVIORL.PRG - 20/10/2020 - kapiabafwh@gmail.com

#include "fivewin.ch"

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

FUNCTION Imp_Silvio()

   LOCAL oPrn, oFont, oFont2, oFont3, oPen, oPen1, oPen2, oPen3, cFiveWin
   LOCAL nLinI, nColI, nLinF, nColF
   LOCAL ResLinha, ResColuna, nLinha, nColuna
   LOCAL nLinTopBox, nColTopBox, nLinBotBox, nColBotBox

   PRINT oPrn NAME "TEST SILVIO BOX, BOX, BOX..." PREVIEW

      DEFINE FONT oFont  NAME "Arial" SIZE 0, - 6  BOLD           OF oPrn
      DEFINE FONT oFont2 NAME "Arial" SIZE 0, - 12 BOLD Underline OF oPrn
      DEFINE FONT oFont3 NAME "Arial" SIZE 0, - 18 BOLD           OF oPrn

      DEFINE PEN oPen  WIDTH 1 COLOR CLR_BLACK                    OF oPrn
      DEFINE PEN oPen1 WIDTH 4 COLOR CLR_BLACK                    OF oPrn
      DEFINE PEN oPen2 WIDTH 2 COLOR CLR_BLACK                    OF oPrn
      DEFINE PEN oPen3 WIDTH 5 COLOR CLR_BLACK                    OF oPrn

      oPrn:SetPage( 9 )  // A4
      oPrn:SetPortrait() //Vertical

      ResLinha  := oPrn:nLogPixely() / 2.54
      ResColuna := oPrn:nLogPixelx() / 2.54

      PAGE

        nLinI :=  1.00
        nColI :=  5.5
        nLinF :=  0.8
        nColF :=  4.5

        nLinha  := nLinI
        nColuna := nColI

        // oPrn:Box( nLinI, nColI, nLinF, nColF, oPen, CLR_GRAY, , "CM" )
        nLinTopBox :=  0.50  //-> Linha Que o Box Inicia Topo
        nColTopBox := 15.00  //-> Largura do Box
        nLinBotBox :=  2.50  //-> Tamanho do Box de Cima Para Baixa
        nColBotBox :=  5.80  //-> Coluna Que o Box Inicia

        oPrn:Cmtr2Pix( @nLinTopBox, @nColTopBox )
        oPrn:cmtr2Pix( @nLinBotBox, @nColBotBox )

        oPrn:Box( nLinTopBox, nColTopBox, nLinBotBox, nColBotBox, oPen3 )

        nColuna := nColuna += 2.10

        // oPrn:cmSay( 1, 5.5, "Tipo documento", oFont, 4.5, CLR_BLACK, , PAD_LEFT  )
        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + "Tipo documento:", oFont,, CLR_BLACK,, PAD_LEFT )

        nLinha  := nLinha += 0.50
        nColuna := 10.5

        //oPrn:cmSay( 1, 5.5, "DESCRIZIONE DOCUMENTO", oFont2, 4.5, CLR_BLACK, , PAD_CENTER  )
        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + "DESCRIZIONE DOCUMENTO", oFont2,, CLR_BLACK,, PAD_CENTER )

        nLinha  := nLinha += 1.50
        nColuna :=  5.0

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + "ESCHOOL: SILVIO FALCONI JUVENILE", oFont2,, CLR_BLACK,, PAD_CENTER )

        nLinha  := nLinha += .80
        nColuna :=  9.50

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + "ESCHOOL: FIVEWIN BRASIL THE BEST", oFont3,, CLR_BLACK,, PAD_CENTER )

        nLinha  := nLinha += .80
        nColuna := 16.50

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + "kapiabafwh@gmail.com", oFont,, CLR_BLACK,, PAD_LEFT )

        nLinha  := nLinha += .50
        nColuna := 13.50

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + "Joao Santos: I Love FiveWin", oFont,, CLR_BLACK,, PAD_LEFT )

        nLinha  := nLinha += .50
        nColuna :=  5.50

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + "Mira se sirve Silvio Falconi", oFont,, CLR_BLACK,, PAD_LEFT )

        nLinha  := nLinha += .50
        nColuna :=  3.50

        cFiveWin := "FiveWin is easy, it's the people who complicate it."

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + cFiveWin, oFont2,, CLR_BLACK,, PAD_LEFT )

        nLinha  := nLinha += 1.00
        nColuna := 14.50

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                ;
           + "By Silvio Falconi: de Italia.", oFont2,, CLR_BLACK,, PAD_LEFT )

      ENDPAGE

   ENDPRINT

   oPen:End()
   oPen1:End()
   oPen2:End()
   oPen3:End()

   oFont:End()
   oFont2:End()
   oFont3:End()

RETURN NIL
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7794
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Printer class question

Postby TimStone » Tue Oct 20, 2020 5:39 pm

Silvio,

This gives you the box:
oPrn:Box( nRow, 1, nRow + ( 63 * nRsp ), 85 * nCsp, oPen )

This gives. you the gray:
oPrn:FillRect( { nRow - ( 1 * nRsp ), 5, nRow + ( nBoxLines * nRsp ), 84.8 * nCsp }, oPrnBrush )

And this gives you the text:
oPrn:SayText( nRow, 41 * nCsp, "INVOICE: ",,, oFbold )

You define the fonts, brushes, and pens.

nRow is determined by a counter you use in your printout to determine the lines for the items

nRsp and nCsp are determined by the orientation and papersize:
// Set the resolution divided by the standard 8.5x11 inch paper rows/columns
nRsp := oPrn:nVertRes() / 68 // Number of rows
nCsp := oPrn:nHorzRes() / 85 // Number of columns

I've used these for years with success. You can even implement color if you wish.

What I haven't tried (yet) is to make an additional METHOD to the class that might be some type of automated function where you feed a single command the coordinates and text and it does all 3 steps for you with one command. It should be easy to build ... I just haven't done it.

Also, I use this with large boxes, with multiple lines of text. It is very flexible.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2943
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Printer class question

Postby Silvio.Falconi » Tue Oct 20, 2020 6:00 pm

my idea was to find an easy procedure to print simple print templates, because by now I understand that I will never be able to use MyRpt, ER, etc.
so I had thought going back to the origins of creating an archive and storing the data for the print model
this afternoon I joke with tPrinter class and I found this but I not Understood How I arrive here

Image

nRow := 5.5
nCol := 1
nWidth := 7.5

@ nRow , nCol PRINT TO oPrn TEXT cText SIZE nWidth - 1,10 CM FONT oFont ALIGN "TL" LASTROW nLast
oPrn:Box( nRow, nCol, nLast + 0.5, nCol + nWidth, nil, CLR_HGRAY, nil, "CM" )

@ nRow+0.2 , nCol PRINT TO oPrn TEXT cText2 SIZE nWidth - 1,10 CM FONT oFont2 ALIGN "TC" //LASTROW nLast
@ nRow , nCol PRINT TO oPrn TEXT cText SIZE nWidth - 1,10 CM FONT oFont ALIGN "TL"


the last line is repeated because the gray box deletes the first line and I couldn't understand why
anyway if you want to help me I'll post the whole test

Code: Select all  Expand view
 #INCLUDE"FIVEWIN.CH"

function printtest()

       local oPrn, oFont, oBrush, nRow, nCol, nWidth, nLast, nHeight
       local cText :="Tipo di Documento"
       local cText2 :="DESCRIZIONE DOCUMENTO"

       PRINT oPrn PREVIEW


       DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-6  OF oPrn
       DEFINE FONT oFont2 NAME "TAHOMA" SIZE 0,-12 BOLD OF oPrn

       PAGE

       nRow     := 5.5
       nCol     := 1
       nWidth   := 7.5

      @ nRow , nCol PRINT TO oPrn TEXT cText SIZE nWidth - 1,10 CM FONT oFont ALIGN "TL" LASTROW nLast
      oPrn:Box( nRow, nCol, nLast + 0.5, nCol + nWidth, nil, CLR_HGRAY, nil, "CM" )
      @ nRow+0.2 , nCol PRINT TO oPrn TEXT cText2 SIZE nWidth - 1,10 CM FONT oFont2 ALIGN "TC" //LASTROW nLast
      @ nRow , nCol PRINT TO oPrn TEXT cText SIZE nWidth - 1,10 CM FONT oFont ALIGN "TL"

       nRow     := 5.5
       nCol     := 9.1
       nWidth   := 7.5

       @ nRow , nCol PRINT TO oPrn TEXT cText SIZE nWidth - 1,10 CM FONT oFont ALIGN "TL" LASTROW nLast
      oPrn:Box( nRow, nCol, nLast + 0.5, nCol + nWidth, nil, CLR_HGRAY, nil, "CM" )
      @ nRow+0.2 , nCol PRINT TO oPrn TEXT cText2 SIZE nWidth - 1,10 CM FONT oFont2 ALIGN "TC" //LASTROW nLast
      @ nRow , nCol PRINT TO oPrn TEXT cText SIZE nWidth - 1,10 CM FONT oFont ALIGN "TL"




       ENDPAGE

       ENDPRINT

       RELEASE FONT oFont
       RELEASE BRUSH oBrush

    return ni
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: Printer class question

Postby karinha » Wed Oct 21, 2020 2:23 am

Mira, se es esto.

Code: Select all  Expand view

// \samples\SHADOW.PRG - 20/10/2020 - kapiabafwh@gmail.com

#include "fivewin.ch"

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

FUNCTION Imp_Silvio()

   LOCAL oPrn, oFont, oFont2, oFont3, oPen, oPen1, oPen2, oPen3, cFiveWin
   LOCAL nLinI, nColI, nLinF, nColF, oBrush
   LOCAL ResLinha, ResColuna, nLinha, nColuna
   LOCAL nLinTopBox, nColTopBox, nLinBotBox, nColBotBox
   LOCAL ShadowIni, ShadowFin

   PRINT oPrn NAME "TEST SILVIO BOX SHADOW..." PREVIEW

      DEFINE BRUSH oBrush COLOR nRGB( 215, 215, 215 )

      DEFINE FONT oFont  NAME "Arial" SIZE 0, - 6  BOLD           OF oPrn
      DEFINE FONT oFont2 NAME "Arial" SIZE 0, - 12 BOLD Underline OF oPrn
      DEFINE FONT oFont3 NAME "Arial" SIZE 0, - 18 BOLD           OF oPrn

      DEFINE PEN oPen  WIDTH 1  COLOR CLR_BLACK                   OF oPrn
      Define Pen oPen1 Width 50 COLOR nRgb( 192, 192, 192 )
      DEFINE PEN oPen2 WIDTH 2  COLOR CLR_BLACK                   OF oPrn
      // aqui Silvio:
      DEFINE PEN oPen3 WIDTH 410 COLOR nRgb( 192, 192, 192 )      OF oPrn

      oPrn:SetPage( 9 )  // A4
      oPrn:SetPortrait() //Vertical

      ResLinha  := oPrn:nLogPixely() / 2.54
      ResColuna := oPrn:nLogPixelx() / 2.54

      PAGE

        nLinha  := 1.00
        nColuna := 5.5

        nLinTopBox :=  1.50  //-> Linha Que o Box Inicia Topo
        nColTopBox := 14.00  //-> Largura do Box
        nLinBotBox :=  2.50  //-> Tamanho do Box de Cima Para Baixo
        nColBotBox :=  8.00  //-> Coluna Que o Box Inicia

        oPrn:Cmtr2Pix( @nLinTopBox, @nColTopBox )
        oPrn:cmtr2Pix( @nLinBotBox, @nColBotBox )

        /* // otro modo
        ShadowIni := oPrn:Cmtr2Pix( nLinTopBox, 6.5 )

        ShadowFin :=  oPrn:cmtr2Pix( nLinBotBox, 14.5 )
        */


        // Shadow Box
        oPrn:Box( nLinTopBox, nColTopBox, nLinBotBox, nColBotBox, oPen3 )

        // oPrn:FillRect( { ShadowIni[1], ShadowIni[2], ShadowFin[1], ShadowFin[2] }, oBrush )

        nColuna := nColuna += 2.10

        // oPrn:cmSay( 1, 5.5, "Tipo documento", oFont, 4.5, CLR_BLACK, , PAD_LEFT  )
        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                    ;
           + "Tipo documento:", oFont,, CLR_BLACK,, PAD_LEFT )

        nLinha  := nLinha += 0.50
        nColuna := 10.5

        //oPrn:cmSay( 1, 5.5, "DESCRIZIONE DOCUMENTO", oFont2, 4.5, CLR_BLACK, , PAD_CENTER  )
        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                    ;
           + "DESCRIZIONE DOCUMENTO", oFont2,, CLR_BLACK,, PAD_CENTER )

        nLinha  := nLinha += 0.80

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                    ;
           + "Silvio Falconi Corporation And FiveWin", oFont,, CLR_BLACK,, PAD_LEFT )

      ENDPAGE

   ENDPRINT

   oPen:End()
   oPen1:End()
   oPen2:End()
   oPen3:End()

   oFont:End()
   oFont2:End()
   oFont3:End()

RETURN NIL
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7794
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Printer class question

Postby Silvio.Falconi » Wed Oct 21, 2020 5:33 am

Sorry,
I research something Easy
I save all data in a dbf and then i Wish call a function
Make all from fields to graphics form

Sample:
Use customer...
Use invoice ...
Use magazzin...
Getform(104)
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: Printer class question

Postby karinha » Wed Oct 21, 2020 12:06 pm

In this case, you must use your imagination ... It is what is expected of an excellent programmer. Basis is that you do not miss this wonderful forum.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7794
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Printer class question

Postby Otto » Wed Oct 21, 2020 12:17 pm

Hello Silvio,
can you please show a image how your print should look like.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6312
Joined: Fri Oct 07, 2005 7:07 pm

Re: Printer class question

Postby karinha » Wed Oct 21, 2020 1:03 pm

Silvio, Use google translator to understand.

I would create a configuration for the entire system as in the example below:

https://i.imgur.com/9W6FzfM.png

Image

Regards.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7794
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Printer class question

Postby nageswaragunupudi » Wed Oct 21, 2020 1:57 pm

Silvio.Falconi wrote:METHOD Box( nTop, nLeft, nBottom, nRight, ;
[Pen], ; // oPen/hPen/nColor/{nColor,nThickness}
[Brush], ; // nColor / oBrush
[aText], ; // { cText, oFont, nColor } Painted in center
cUnits ; // "CM", "MM", "INCHES"
)

I tried to use aText array but I can set only { cText, oFont, nColor } and it was printed in center
How I can to print it with align ?


Now, aText can be { cText, oFont, nTxtColor, cAlign }

cAlign:
"TL" : TopLeft
"TR" : TopRight
"T" : Top Center
"BL" : Bottom Left
"BR" : Bottom Right
"B" : Bottom Center
"L" : Left Vert Center
"R" : Right Vert Center

But you can use this for only String, though this string can be multi-line delimited by CRLF.
If you want to print 2 or more strings with different alignments, you need to write your own code for that.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Printer class question

Postby nageswaragunupudi » Wed Oct 21, 2020 2:40 pm

Code: Select all  Expand view
function PrnBox()

   local oPrn, oFont, oBrush

   DEFINE BRUSH oBrush FILE "c:\fwh\bitmaps\backgrnd\pebbles.bmp"
   PRINT oPrn PREVIEW
   DEFINE FONT oFont NAME "VERDANA" SIZE 0,-30 OF oPrn BOLD

   PAGE
   oPrn:RoundBox( 1, 1, 5, 5, .5, .5, { CLR_HRED, 3 }, oBrush, ;
                  { "FIRST" + CRLF + "SECOND", oFont, CLR_WHITE, "B" }, ;
                  "INCHES" )
   @ 1,1 PRINT TO oPrn TEXT "HOLLOW TEXT" SIZE 4, 4 INCHES FONT oFont ;
         COLOR CLR_YELLOW OUTLINE CLR_HRED SIZE 3 ALIGN "T"

   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont
   RELEASE BRUSH oBrush

return nil


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 18 guests