A problem < oPRINT:cmSay( ..> with MULTILINE get ?

A problem < oPRINT:cmSay( ..> with MULTILINE get ?

Postby ukoenig » Sun Apr 03, 2016 10:05 am

Hello,

I want to print a MULTILE get and use

oPRINT:cmSay(nRow1,12.2, MEMOLINE(aDatP[20]), oFont1,,CLR_BLACK,,PAD_LEFT )

also tested :

Code: Select all  Expand view

n := 1
WHILE n < 8
     oPRINT:cmSay( nZeile1, 12.2, MEMOLINE(aDatP[20]), oFont1,,CLR_BLACK,,PAD_LEFT )
     nZeile1+= 0.5 // linefeed
     n++
END  
 

but shows 7 lines "AAAAAAAAAAAAAAAAA"

but doesn't work

Ok I can search for CRLF inside the get and cut the get in pieces
but maybe another solution ?

Image

best regards
Uwe :?:
Last edited by ukoenig on Sun Apr 03, 2016 11:17 am, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A problem < oPRINT:cmSay( ..> with MULTILINE get ?

Postby cnavarro » Sun Apr 03, 2016 10:35 am

Maybe, fwh\samples\report\rep20.prg, can help
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: A problem < oPRINT:cmSay( ..> with MULTILINE get ?

Postby ukoenig » Sun Apr 03, 2016 11:16 am

Cristobal,

using the logic of this report sample it is working fine

The width and hight of the get must be adjusted to the used fontsize
to get the same result inside the report

Image

Code: Select all  Expand view

nZeile1 := 2.6 // startrow
....
....
IF !EMPTY( aDatP[20] )  // multine get
     FOR nFor := 1 TO 7 // 7 Lines
          cLine := MEMOLINE( aDatP[20], 40, nFor ) // 40 chars each line
          oPRINT:cmSay( nZeile1, 12.2, cLine, oFont1,,CLR_BLACK,,PAD_LEFT )
          nZeile1+= 0.5 // linefeed
     NEXT
ENDIF
....
....
nZeile1 += 3.7
 


best regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A problem < oPRINT:cmSay( ..> with MULTILINE get ?

Postby nageswaragunupudi » Sun Apr 03, 2016 3:46 pm

Mr Uwe

oPrn:SayText() is an improved version over earlier methods oPrn:Say(),etc., which handle only single line texts.
This method prints both single line and / or multiline text with word-wrapping depending on the size of text and size of the rectangle provided. This method is particulary intended to ease the programmers' work, by avoiding the need to break the text into individual lines and printing line by line.

Syntax:
SayText( nRow, nCol, cText, [nWidth], [nHeight], [oFont], [cAlign], [nClrText], [nClrBack] ) --> nLastRowInPixels

All coordinates are in pixels.
nWidth: It is desirable to provide nWidth parameter.

nHeight: If we do not now how much height the entire text requires to be printed, set nHeight to NIL.

cAlign: Values can be 'T','L','B','R','TL','TR','LB','BR'. Text is aligned within rectangle as specfied in the parameter. Default is TL (TopLeft)

Return Value: This method returns the Last Row in pixels used for printing the text. We can use this result to know the row from which we can continue printing the next text or images.

Here is a small sample:
Code: Select all  Expand view

#include "fivewin.ch"

func dbtest()

   local oDlg, oGet, cText := ""
   local oFont

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-16
   DEFINE DIALOG oDlg SIZE 300,300 PIXEL TRUEPIXEL FONT oFont

   @ 20,20 GET oGet VAR cText MEMO SIZE 260,220 PIXEL OF oDlg

   @ 255,20 BUTTON "Print" SIZE 80,30 PIXEL OF oDlg ACTION PrintGet( cText, oFont )

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont

return nil

static function PrintGet( cText, oTextFont )

   local oPrn, oFont, aPoint, nRow, nCol, nWidth

   PRINT oPrn PREVIEW

   DEFINE FONT oFont NAME oTextFont:cFaceName SIZE 0,-oTextFont:nHeight OF oPrn

   PAGE

   aPoint   := oPrn:Cmtr2Pix( 2.6, 10.0 )
   nRow     := aPoint[ 1 ]
   nCol     := aPoint[ 2 ]

   nRow  := oPrn:SayText( nRow, nCol, cText, @nWidth, nil, oFont )
   oPrn:Line( nRow, nCol, nRow, nCol + nWidth )

   ENDPAGE

   ENDPRINT

   RELEASE FONT oFont

return nil
 

Note: The word wrapping of the printed text depends on the font size and width provided and may not exactly match the text in the Get. However if each line in the Get is terminated by CRLF then the printed text also honors the same CRLFs while word wrapping.
Image
Regards

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

Re: A problem < oPRINT:cmSay( ..> with MULTILINE get ?

Postby ukoenig » Sun Apr 03, 2016 6:50 pm

Mr. Rao,

works fine !!!

my changes :

Code: Select all  Expand view

IF !EMPTY( aDatP[20] )
     aPoint   := oPRINT:Cmtr2Pix( nZeile1, 12.2 )
     nWidth := 720
     nRow     := aPoint[ 1 ]
     nCol     := aPoint[ 2 ]
     nRow  := oPRINT:SayText( nRow, nCol, aDatP[20], @nWidth, NIL, oFont1 )
     oPRINT:Line( nRow, nCol, nRow, nCol + nWidth )
ENDIF

// old
// IF !EMPTY( aDatP[20] )
//     FOR nFor := 1 TO 7 // 7 Lines
//          cLine := MEMOLINE( aDatP[20], 40, nFor ) // 40 chars
//          oPRINT:cmSay( nZeile1,12.2,  cLine, oFont1,,CLR_BLACK,,PAD_LEFT  )
//          nZeile1+= 0.5
//     NEXT
//ENDIF
 


best regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A problem < oPRINT:cmSay( ..> with MULTILINE get ?

Postby nageswaragunupudi » Sun Apr 03, 2016 9:52 pm

In your case. because you know the width of the column, you may specify nWidth
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Enrico Maria Giordano, Google [Bot] and 139 guests