How run TextInBox

How run TextInBox

Postby Silvio.Falconi » Thu May 14, 2020 3:35 pm

I'm trying to create a text into a box with printer class
but not run ok


I made
Code: Select all  Expand view  RUN
#include "FiveWin.ch"
 function Main()
    local oPrn, cText
    local  oFont
    local cmLeft
    local cmTexto
 
 
   PRINTER oPrn PREVIEW

      DEFINE FONT oFont NAME "Courier New" SIZE 0, -10 OF oPrn
      DEFINE PEN  oPen1  STYLE PS_SOLID WIDTH 2 OF oPrn
     
      PAGE

      oPrn:TextInBox( 10,5,"Ai sensi dell'art. 10 della legge 675/96 'Tutela delle persone e di altri soggetti rispetto al trattamento dei dati personali'"+CRLF+;
                                        " La informiamo che i dati personali da Lei forniti saranno trattati, nel rispetto degli obblighi di legge",2,2,oFont,oPen1 )

      ENDPAGE          
     
   ENDPRINTER
   
 
   oFont:End()

return





but it not create the box and print the text on one line

Image


how do I print a justified text (or rtf file) with printer class ?
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: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: How run TextInBox

Postby Otto » Thu May 14, 2020 5:33 pm

Silvio,
look into vrd.prg for ::SayMemo or ::SayMemoJust. There you see one way how it can be done.
Code: Select all  Expand view  RUN

METHOD SayMemo( nTop, nLeft, nWidth, nHeight, cText, oFont, nColor, nPad, lVariHeight ) CLASS VRD

   LOCAL i
   LOCAL nTmpHeight     := 0
   LOCAL lMemoPageBreak := .F.
   LOCAL nLines         := MlCount( cText, 240 )
   LOCAL aAbstand       := ::oPrn:Cmtr2Pix( 0.2, 0.2 )

   FOR i := 1 TO nLines

      ::Say( nTop, nLeft, RTRIM(MemoLine( cText, 240, i )), oFont, nWidth, nColor,, nPad )

      nTop       += oFont:nHeight + aAbstand[1]
      nTmpHeight += oFont:nHeight + aAbstand[1]

      IF nTmpHeight > nHeight .AND. lVariHeight = .F.
         EXIT
      ELSEIF nTop >= ::nPageBreak
         //::PageBreak()
         //lMemoPageBreak := .T.
         //nTop           := ::nNextRow
         //nTmpHeight     := nTop
      ENDIF

   NEXT

RETURN { nTmpHeight, lMemoPageBreak }

 



Or make a little ER.


Code: Select all  Expand view  RUN

function multilineText()

    local oVRD
    local lPreview      := .t.
    local cDruckerName  := ""
    local cTITLE := ""
   *----------------------------------------------------------
   
    cTITLE := "Ai sensi dell'art. 10 della legge 675/96 'Tutela delle persone e di altri soggetti rispetto al trattamento dei dati personali. La informiamo che i dati personali da Lei forniti saranno trattati, nel rispetto degli obblighi di legge"


    TPreview():lListViewHide := .T.

    EASYREPORT oVRD NAME ".\xVrd\multilineText.vrd"  PREVIEW  lPreview TO cDruckerName PRINTDIALOG IIF( lPreview, .F., .F. ) MODAL

    PRINTAREA 1 OF oVRD   ;
               ITEMIDS    {  100 } ;
               ITEMVALUES { cTITLE }


    oVRD:End()

return nil

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


 


Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Re: How run TextInBox

Postby nageswaragunupudi » Sun May 17, 2020 3:22 pm

Please try
Code: Select all  Expand view  RUN
function printtest()

   local oPrn, oFont, oBrush, nRow, nCol, nWidth, nLast, nHeight
   local cText := "Ai sensi dell'art. 10 della legge 675/96 'Tutela delle persone e di altri soggetti rispetto al trattamento dei dati personali'"+CRLF+;
                  "La informiamo che i dati personali da Lei forniti saranno trattati, nel rispetto degli obblighi di legge"

   PRINT oPrn PREVIEW

   DEFINE BRUSH oBrush FILE "c:\fwh\bitmaps\backgrnd\beach.bmp"
   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14 BOLD OF oPrn

   PAGE

   nRow     := 5
   nCol     := 2
   nWidth   := 10

   @ nRow + 0.5, nCol + 0.5 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, nil, nil, "CM" )

   nHeight  := nLast - nRow + 1
   nRow     := nLast + 1

   oPrn:Box( nRow, nCol, nRow + nHeight, nCol + nWidth, ;
      { CLR_HRED, 2 }, oBrush, { cText, oFont, CLR_BLUE }, "CM" )

   ENDPAGE

   ENDPRINT

   RELEASE FONT oFont
   RELEASE BRUSH oBrush

return nil


Image
Regards

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

Re: How run TextInBox

Postby Otto » Sun May 17, 2020 3:38 pm

Dear Mr. Rao,
I used :BOX but you have problems with pagebreak.

Best regards,
Otto

Code: Select all  Expand view  RUN


ELSEIF nTop >= ::nPageBreak
         //::PageBreak()
         //lMemoPageBreak := .T.
         //nTop           := ::nNextRow
         //nTmpHeight     := nTop
      ENDIF

 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Re: How run TextInBox

Postby Silvio.Falconi » Sun May 17, 2020 8:56 pm

thanks rao
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: 7075
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 75 guests