Page 1 of 1

dcmultiline wordwrap

Posted: Thu Feb 10, 2011 1:18 pm
by bobvolz
I use DCMULTILINE to enter text for email messages.

The code is as follows:
@ 9,0 DCMULTILINE cText SIZE 90,10 FONT '10.Courier' OBJECT oCtext NOHORIZSCROLL
This code does automatic word wrap on the screen.

The problem I have is that if the user simply keeps typing and lets the wordwrap do its job the resulting email that goes out is one long line of text. It is not completely visible on an email reader box such as AOl or Gmail.

If the user does press the return key at the end of every line the resulting email is fine.

How do I insert a Chr(13)+Chr(10) at the end of every line so that the resulting email message fits into a standard email reader box

I wrap the final cText varaiable with the HTML command <pre> just before I send it.

cText:='<pre>'+cText+'</pre>'

This allows me to send canned messages that may contain some html references and formatting.

Does anyone have an email message screen that doesn't have these issues.

Bob Volz
Meadowland Systems

Re: dcmultiline wordwrap

Posted: Thu Feb 10, 2011 1:36 pm
by rdonnay
Try this:

Code: Select all

FUNCTION FixText( cText )

LOCAL aText, cOutText, i

aText := DC_StrWrap( cText )
cOutText := ''

FOR i := 1 TO Len(aText)
  cOutText += aText[i] + Chr(13)+Chr(10)
NEXT

RETURN cOutText

Re: dcmultiline wordwrap

Posted: Thu Feb 10, 2011 2:15 pm
by bobvolz
Hi Roger;

I got your function to work by adding a numeric var to DC_StrWrap
and then changing the value of cText to cOutText.
Now the emails fit nicely. Thanks again.
Hope all is well with you.

Bob Volz



FUNCTION FixText( cText )

LOCAL aText, cOutText, i

aText := DC_StrWrap( cText,75 )
cOutText := ''

FOR i := 1 TO Len(aText)
cOutText += aText + Chr(13)+Chr(10)
NEXT
cText:=cOutText
RETURN cText

Re: dcmultiline wordwrap

Posted: Fri Feb 11, 2011 12:55 am
by skiman
Hi,

I suppose the following would work also:
cText := memotran(cText,Chr(13)+Chr(10),Chr(13)+Chr(10))

This should give the same result, same lines and lenght, as you entered in your mail screen.