Best way is to use an instance of the control to measure so it will
factor in styles and everything.  The DG sometimes uses one instance of
your renderer to measure several different rows

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Denis
Sent: Wednesday, April 23, 2008 8:17 AM
To: [email protected]
Subject: [flexcoders] Measuring the width of text without rendering a
control

 

Hi all,

I need to measure the size of the number of text fields that come from
the XML to display them in a datagrid. The size of datagrid columns
depends on the width of the text records that come from the database
as the text cannot wrap so the columns should adjust if possible. The
logic is a bit complex since I need to know the width of all text in
all columns before distributing width among columns.

How can I measure the width of the text without adding a child text
control to my parent object to measure the text. I would like to avoid
creating a dummy textbox in my container just to measure the width of
the text records but I did not find anything on the web that deals
with this. 

I was planning to measure the text width after the data is loaded
since it needs to be done only once. Can I create an "abstract" Text
object and measure the size of the text within it? I apologize for
awkward wording but I am not very experienced in Flex yet.

Thanks in advance,
Denis

 

Reply via email to