Tech Tip: Line breaks in 4D SVG TextArea
PRODUCT: 4D | VERSION: 12 | PLATFORM: Mac & Win
Published On: July 11, 2011
Beginning with 4D SVG v12 SVG_New_textArea supports line breaks. The TextArea automatically supports auto wordwrap but before 4D v12 there was no way to force a line break.
To get the line break effect as shown in the image below, use one the techniques as shown in the code snippets below:
In this example the 4D escape sequences of "\r" are used to create the line breaks.
$SVG_T:=SVG_New $rec:=SVG_New_rect ($SVG_T;5;5;410;220;0;0;"#777";"peachpuff";3) $txt:="Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed non risus." $txt:=$txt+"\r\rSuspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor." $txtArea:=SVG_New_textArea ($SVG_T;$txt;10;10;400;210;"Georgia";25;Plain;5) SVGTool_SHOW_IN_VIEWER ($SVG_T) SVG_CLEAR ($SVG_T) |
In this example the 4D function Char(Carriage return) is used to create the line breaks.
$SVG_T:=SVG_New $rec:=SVG_New_rect ($SVG_T;5;5;410;220;0;0;"#777";"peachpuff";3) $txt:="Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed non risus." $txt:=$txt+Char(Carriage return)+Char(Carriage return)+"Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor." $txtArea:=SVG_New_textArea ($SVG_T;$txt;10;10;400;210;"Georgia";25;Plain;5) SVGTool_SHOW_IN_VIEWER ($SVG_T) SVG_CLEAR ($SVG_T) |
In this example the 4D function Char(Line feed) is used to create the line breaks.
$SVG_T:=SVG_New $rec:=SVG_New_rect ($SVG_T;5;5;410;220;0;0;"#777";"peachpuff";3) $txt:="Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed non risus." $txt:=$txt+Char(Line feed)+Char(Line feed)+"Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor." $txtArea:=SVG_New_textArea ($SVG_T;$txt;10;10;400;210;"Georgia";25;Plain;5) SVGTool_SHOW_IN_VIEWER ($SVG_T) SVG_CLEAR ($SVG_T) |