You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Oleg Konovalov <ol...@gmail.com> on 2013/02/08 19:15:14 UTC

TextArea ignoring new lines

Hi,


I am working on old Flex3 (Cairngorm2) app.

One of TextArea's there is completely ignoring new lines (Carriage
Return/Line Feed)

and even skips some spaces (others work fine).


Code is pretty simple (well, little simplified here):

<fx:TextArea  text="myText" selectable=true change=updateText(event)"/>

...


private function updateText(evt:Event):void {

 var event:UpdateEvent = new UpdateEvent(UpdateEvent.UPDATE_EVENT);

  event.myText=myText.text;

  trace("myText"+event.myText) //added by me

  event.dispatch();

}



I have read about weird behaviors of TextArea (skipping or even doubling
some characters) on the net,

but so far could not find anything applicable in that case.


For example, something like    myText.text.replace("\n", "\r") doesn't
change anything.

I guess, there is no "\n" there.


If I trace, it returns line without newlines (like:
 'startskip1lineskip2linesend;').

But if I copy-paste that line to say another TextArea on the screen (or non
flex Chat app, I would get multiline text:

'start


skip1line



skip2lines

end;


And for various reasons I can't debug that app.


Any idea what might be wrong and how to fix it?


Please help!


TIA,

Oleg.

P.S.:  App connects to SPs in the Database via Web Service. No BlazeDS.

Re: TextArea ignoring new lines

Posted by Alex Harui <ah...@adobe.com>.
Are there \r or \n in the strings?  Try using getCharAt() to examine the
string.  If there are, then somehow, the multiline flag got turned off on
the internal text widget.


On 2/11/13 6:51 AM, "Oleg Konovalov" <ol...@gmail.com> wrote:

> I can see '\' characters in myTextArea.text.  Should I try replacing them
> with '\n' or that won't help?
> As I said, that TA doesn't display new lines.  Any TA properties can help?
> 
> TIA,
> Oleg
> On Feb 8, 2013 1:15 PM, "Oleg Konovalov" <ol...@gmail.com> wrote:
> 
>> Hi,
>> 
>> 
>> I am working on old Flex3 (Cairngorm2) app.
>> 
>> One of TextArea's there is completely ignoring new lines (Carriage
>> Return/Line Feed)
>> 
>> and even skips some spaces (others work fine).
>> 
>> 
>> Code is pretty simple (well, little simplified here):
>> 
>> <fx:TextArea  text="myText" selectable=true change=updateText(event)"/>
>> 
>> ...
>> 
>> 
>> private function updateText(evt:Event):void {
>> 
>>  var event:UpdateEvent = new UpdateEvent(UpdateEvent.UPDATE_EVENT);
>> 
>>   event.myText=myText.text;
>> 
>>   trace("myText"+event.myText) //added by me
>> 
>>   event.dispatch();
>> 
>> }
>> 
>> 
>> 
>> I have read about weird behaviors of TextArea (skipping or even doubling
>> some characters) on the net,
>> 
>> but so far could not find anything applicable in that case.
>> 
>> 
>> For example, something like    myText.text.replace("\n", "\r") doesn't
>> change anything.
>> 
>> I guess, there is no "\n" there.
>> 
>> 
>> If I trace, it returns line without newlines (like:
>>  'startskip1lineskip2linesend;').
>> 
>> But if I copy-paste that line to say another TextArea on the screen (or
>> non flex Chat app, I would get multiline text:
>> 
>> 'start
>> 
>> 
>> skip1line
>> 
>> 
>> 
>> skip2lines
>> 
>> end;
>> 
>> 
>> And for various reasons I can't debug that app.
>> 
>> 
>> Any idea what might be wrong and how to fix it?
>> 
>> 
>> Please help!
>> 
>> 
>> TIA,
>> 
>> Oleg.
>> 
>> P.S.:  App connects to SPs in the Database via Web Service. No BlazeDS.
>> 
>> 
>> 

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui


Re: TextArea ignoring new lines

Posted by Oleg Konovalov <ol...@gmail.com>.
I can see '\' characters in myTextArea.text.  Should I try replacing them
with '\n' or that won't help?
As I said, that TA doesn't display new lines.  Any TA properties can help?

TIA,
Oleg
On Feb 8, 2013 1:15 PM, "Oleg Konovalov" <ol...@gmail.com> wrote:

> Hi,
>
>
> I am working on old Flex3 (Cairngorm2) app.
>
> One of TextArea's there is completely ignoring new lines (Carriage
> Return/Line Feed)
>
> and even skips some spaces (others work fine).
>
>
> Code is pretty simple (well, little simplified here):
>
> <fx:TextArea  text="myText" selectable=true change=updateText(event)"/>
>
> ...
>
>
> private function updateText(evt:Event):void {
>
>  var event:UpdateEvent = new UpdateEvent(UpdateEvent.UPDATE_EVENT);
>
>   event.myText=myText.text;
>
>   trace("myText"+event.myText) //added by me
>
>   event.dispatch();
>
> }
>
>
>
> I have read about weird behaviors of TextArea (skipping or even doubling
> some characters) on the net,
>
> but so far could not find anything applicable in that case.
>
>
> For example, something like    myText.text.replace("\n", "\r") doesn't
> change anything.
>
> I guess, there is no "\n" there.
>
>
> If I trace, it returns line without newlines (like:
>  'startskip1lineskip2linesend;').
>
> But if I copy-paste that line to say another TextArea on the screen (or
> non flex Chat app, I would get multiline text:
>
> 'start
>
>
> skip1line
>
>
>
> skip2lines
>
> end;
>
>
> And for various reasons I can't debug that app.
>
>
> Any idea what might be wrong and how to fix it?
>
>
> Please help!
>
>
> TIA,
>
> Oleg.
>
> P.S.:  App connects to SPs in the Database via Web Service. No BlazeDS.
>
>
>