[flexcoders] Re: resizing a textArea to fit Text of the container.

2008-05-01 Thread Dmitri Girski
TextField has a problem calculating numLines if text contains CR/LF
symbols.


Dmitri.


--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 At measure time, it's width may not have been passed to the internal
 textfield.
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Frederico Garcia
 Sent: Sunday, March 09, 2008 7:37 PM
 To: flexcoders@yahoogroups.com
 Subject: Re: [flexcoders] Re: resizing a textArea to fit Text of the
 container.
 
  
 
 targetplanet escreveu:
  I thought about that, initially the width was wet to 100%, so I tried
  changing it to a fixed width of 400 and it still returned the crazy
  textHeight numbers. The only thing I can think it might be is that I
  am creating the textArea in actionscript, so it may not be initialized
  or something. 
 
  --- In flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com , Alex Harui aharui@ wrote:
  
  What is the width (not textWidth) of the TextArea? If it is narrow,
 it
  will affect textHeight. If you look at measurement code in Text.as or
  in ListItemRenderer.as, you'll see that we fix the width before
 getting
  textHeight.
 
  
 
  
 
  From: flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com
 [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
 ] On
  Behalf Of targetplanet
  Sent: Wednesday, March 05, 2008 1:08 PM
  To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 
  Subject: [flexcoders] Re: resizing a textArea to fit Text of the
  container.
 
  
 
  --- In flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com
 mailto:flexcoders%40yahoogroups.com
  , Manish Jethani
  manish.jethani@ wrote:
  
  On 2/28/08, targetplanet rsprague@ wrote:
 
  
  but it seems the textHeight can't be relied on, because it gives me
  crazy numbers that can't be right, like for 3 lines of text it says
  its 250.
  I am using htmlText, so I don't know if that matters.
  
  Do you have a lot of whitespace before and after those 3 lines of
  text? You could set 'condenseWhite' to true, that might help.
 
  Manish
 
  
  I have set condenseWhite to true, but it is still returning a
  ridiculous number: 5 lines of text it says is 510 heigh. I set
  condenseWhite to false, and it added 20 to the height, so I know the
  condenseWhite is working some what. I am calling validateNow, so that
  doesn't seem to be the issue.
 
  
 
 
 
 
  --
  Flexcoders Mailing List
  FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt 
  Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.com
 http://www.mail-archive.com/flexcoders%40yahoogroups.com  
  Yahoo! Groups Links
 
 
 
 
  __ NOD32 2932 (20080309) Information __
 
  This message was checked by NOD32 antivirus system.
  http://www.eset.com http://www.eset.com 
 
 
 
  
 Hi,
 
 Take a look at PrintTextArea in 
 http://code.google.com/p/flexreport/source/browse
 http://code.google.com/p/flexreport/source/browse  
 (trunk/flexreport/org/print/PrintTextArea.mxml). It's not exactly for 
 what you want (since it's pageable) but you can see how I get the text 
 metrics.
 
 Hope this helps,
 
 Frederico Garcia





[flexcoders] Re: resizing a textArea to fit Text of the container.

2008-05-01 Thread Dmitri Girski
--- In flexcoders@yahoogroups.com, Dmitri Girski [EMAIL PROTECTED] wrote:

 TextField has a problem calculating numLines if text contains CR/LF
 symbols.
 

Still, I don't know why you've got such a difference in your case.

I am using the following thing: 
override public function set text(val:String)
{
  super.text = val;
  for (var i:uint = 0; i  super.text.length; i++)
  {
   if (super.text.charAt(i) == '\r' || super.text.charAt(i) == '\n')
   {
  m_iParagraphNo++;
} 
  }
}

and then use iParagraphNo in set height() - adding the corresponding
number of extra lines.

Cheers,
Dmitri. 



[flexcoders] Re: resizing a textArea to fit Text of the container.

2008-03-05 Thread targetplanet
--- In flexcoders@yahoogroups.com, Manish Jethani
[EMAIL PROTECTED] wrote:

 On 2/28/08, targetplanet [EMAIL PROTECTED] wrote:
 
   but it seems the textHeight can't be relied on, because it gives me
   crazy numbers that can't be right, like for 3 lines of text it says
   its 250.
   I am using htmlText, so I don't know if that matters.
 
 Do you have a lot of whitespace before and after those 3 lines of
 text? You could set 'condenseWhite' to true, that might help.
 
 Manish

I have set condenseWhite to true, but it is still returning a
ridiculous number: 5 lines of text it says is 510 heigh.  I set
condenseWhite to false, and it added 20 to the height, so I know the
condenseWhite is working some what. I am calling validateNow, so that
doesn't seem to be the issue.
 



RE: [flexcoders] Re: resizing a textArea to fit Text of the container.

2008-03-05 Thread Alex Harui
What is the width (not textWidth) of the TextArea?  If it is narrow, it
will affect textHeight.  If you look at measurement code in Text.as or
in ListItemRenderer.as, you'll see that we fix the width before getting
textHeight.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of targetplanet
Sent: Wednesday, March 05, 2008 1:08 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: resizing a textArea to fit Text of the
container.

 

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Manish Jethani
[EMAIL PROTECTED] wrote:

 On 2/28/08, targetplanet [EMAIL PROTECTED] wrote:
 
  but it seems the textHeight can't be relied on, because it gives me
  crazy numbers that can't be right, like for 3 lines of text it says
  its 250.
  I am using htmlText, so I don't know if that matters.
 
 Do you have a lot of whitespace before and after those 3 lines of
 text? You could set 'condenseWhite' to true, that might help.
 
 Manish

I have set condenseWhite to true, but it is still returning a
ridiculous number: 5 lines of text it says is 510 heigh. I set
condenseWhite to false, and it added 20 to the height, so I know the
condenseWhite is working some what. I am calling validateNow, so that
doesn't seem to be the issue.