[flexcoders] Re: Custom List ItemRenderer / Recycling troubles (height incorrect)

2009-04-18 Thread Tim Hoff

Hi,

Set the List's variableRowHeight=true and use something like this in
the itemRenderer:

override protected function measure():void
{
  var textLineMetrics:TextLineMetrics = comment.measureText(
comment.text );

  // should add paddingTop, paddingBottom and verticalGap to this too
  measuredHeight = textLineMetrics.height + myLinkButton.height;
}

-TH

--- In flexcoders@yahoogroups.com, Tracy Spratt tr...@... wrote:

 Sorry, no magic sauce here. I had some pixie dust somewhere, but. Was
it
 Asimov or Clark that said, Any sufficiently advanced technology is
 indistinguishable from magic?



 When I needed a variable height renderer, I copied ListItemRenderer
and
 modified to my needs. That was the only way I could get it to work. It
is
 also *much* more performant than a container based renderer. The magic
is
 indeed in the measure() function.



 If you do not have a lot of items to renderer, Repeater works well
with
 variable heights.



 Tracy Spratt,

 Lariat Services, development services available

 _

 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com]
On
 Behalf Of wubac1
 Sent: Saturday, April 18, 2009 2:02 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Custom List ItemRenderer / Recycling troubles
(height
 incorrect)








 I'm attempting to create a very simple item renderer for mx:List. I've
found
 that when the dataProvider is static, there are no problems with the
custom
 item
 renderer. However, when the dataProvider is dynamic, the height of the
item
 renderer is not correct (and scroll bars appear for each renderer with
any
 meaningful # of rows). I've set variableRowHeight=true for the List.
I've
 also tried overriding the measure function and invaliding the size
when a
 dataChange event is dispatched (based on information provided on
FlexCoders
 in previous discussions along these lines).

 CommentRenderer.mxml:

 ?xml version=1.0 encoding=utf-8?
 mx:VBox xmlns:mx=http://www.adobe. http://www.adobe.com/2006/mxml
 com/2006/mxml width=100%
 mx:Script
 ![CDATA[
 override protected function measure():void
 {
 super.measure();
 measuredHeight = comment.textHeight;
 }
 ]]
 /mx:Script
 mx:LinkButton label={data.commenter.name}/
 mx:Text id=comment width=100% text={data.comment}
 dataChange=invalidateSize()/
 /mx:VBox

 The mx:List definition:

 mx:List id=comments itemRenderer=com.test.CommentRenderer
width=100%
 height=100%/

 I've looked over the ListItemRenderer, but have so far been unable to
glean
 the
 magic sauce that makes the item renderer function correctly when the
control
 recycles. Can someone explain / provide a functional example(s) with
mx:Text
 (ActionScript and MXML examples preferred, for completeness)?





[flexcoders] Re: Custom List ItemRenderer / Recycling troubles (height incorrect)

2009-04-18 Thread wubac1
Tracy, I have to agree.  I was able to get a fully functional item renderer 
based on ListItemRenderer.  However, in theory, one should be able to do it in 
MXML.  With that in mind, I replaced the UITextField with mx:Text.  It's 
probably not surprising to many that the renderer does not behave as expected 
anymore.  The height issue appears to be tied to the component in some fashion. 
 I'd file a defect but I haven't seen much ROI in such reports.

--- In flexcoders@yahoogroups.com, Tracy Spratt tr...@... wrote:

 Sorry, no magic sauce here.  I had some pixie dust somewhere, but. Was it
 Asimov or Clark that said, Any sufficiently advanced technology is
 indistinguishable from magic?
 
  
 
 When I needed a variable height renderer, I copied ListItemRenderer and
 modified to my needs.  That was the only way I could get it to work. It is
 also *much* more performant than a container based renderer.  The magic is
 indeed in the measure() function.  
 
  
 
 If you do not have a lot of items to renderer, Repeater works well with
 variable heights.
 
  
 
 Tracy Spratt,
 
 Lariat Services, development services available
 
   _  
 
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
 Behalf Of wubac1
 Sent: Saturday, April 18, 2009 2:02 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Custom List ItemRenderer / Recycling troubles (height
 incorrect)
 
  
 
 
 
 
 
 
 I'm attempting to create a very simple item renderer for mx:List. I've found
 that when the dataProvider is static, there are no problems with the custom
 item
 renderer. However, when the dataProvider is dynamic, the height of the item
 renderer is not correct (and scroll bars appear for each renderer with any
 meaningful # of rows). I've set variableRowHeight=true for the List. I've
 also tried overriding the measure function and invaliding the size when a
 dataChange event is dispatched (based on information provided on FlexCoders
 in previous discussions along these lines).
 
 CommentRenderer.mxml:
 
 ?xml version=1.0 encoding=utf-8?
 mx:VBox xmlns:mx=http://www.adobe. http://www.adobe.com/2006/mxml
 com/2006/mxml width=100%
 mx:Script
 ![CDATA[
 override protected function measure():void
 {
 super.measure();
 measuredHeight = comment.textHeight;
 }
 ]]
 /mx:Script
 mx:LinkButton label={data.commenter.name}/
 mx:Text id=comment width=100% text={data.comment}
 dataChange=invalidateSize()/
 /mx:VBox
 
 The mx:List definition:
 
 mx:List id=comments itemRenderer=com.test.CommentRenderer width=100%
 height=100%/
 
 I've looked over the ListItemRenderer, but have so far been unable to glean
 the
 magic sauce that makes the item renderer function correctly when the control
 recycles. Can someone explain / provide a functional example(s) with mx:Text
 (ActionScript and MXML examples preferred, for completeness)?





[flexcoders] Re: Custom List ItemRenderer / Recycling troubles (height incorrect)

2009-04-18 Thread wubac1
Tim, I have been using the variableRowHeight (see my original example).  Also, 
one should not need to replicate the measure of mx:Text.  Your example 
disregards internal padding elements of the Text component.  I did try 
setActualSize combined with getExplicitOrMeasuredHeight, but that only works in 
ActionScript.  I encourage you to try and create a functional example.  I'm 
fairly confident at this point that you will not get one working in MXML with 
mx:Text (multi-line).

I was able to get a fully functional item renderer based on ListItemRenderer, 
which uses UITextField. However, in theory, one should be able to do it in 
MXML. With that in mind, I replaced the UITextField of my ActionScript-based 
renderer with mx:Text. It's probably not surprising to many that the renderer 
no longer behaves as expected. The height issue appears to be tied to the 
component in some fashion (mx:Text in this case).  I'd file a defect but I 
haven't seen much ROI in such reports.

--- In flexcoders@yahoogroups.com, Tim Hoff timh...@... wrote:

 
 Hi,
 
 Set the List's variableRowHeight=true and use something like this in
 the itemRenderer:
 
 override protected function measure():void
 {
   var textLineMetrics:TextLineMetrics = comment.measureText(
 comment.text );
 
   // should add paddingTop, paddingBottom and verticalGap to this too
   measuredHeight = textLineMetrics.height + myLinkButton.height;
 }
 
 -TH
 
 --- In flexcoders@yahoogroups.com, Tracy Spratt tracy@ wrote:
 
  Sorry, no magic sauce here. I had some pixie dust somewhere, but. Was
 it
  Asimov or Clark that said, Any sufficiently advanced technology is
  indistinguishable from magic?
 
 
 
  When I needed a variable height renderer, I copied ListItemRenderer
 and
  modified to my needs. That was the only way I could get it to work. It
 is
  also *much* more performant than a container based renderer. The magic
 is
  indeed in the measure() function.
 
 
 
  If you do not have a lot of items to renderer, Repeater works well
 with
  variable heights.
 
 
 
  Tracy Spratt,
 
  Lariat Services, development services available
 
  _
 
  From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com]
 On
  Behalf Of wubac1
  Sent: Saturday, April 18, 2009 2:02 AM
  To: flexcoders@yahoogroups.com
  Subject: [flexcoders] Custom List ItemRenderer / Recycling troubles
 (height
  incorrect)
 
 
 
 
 
 
 
 
  I'm attempting to create a very simple item renderer for mx:List. I've
 found
  that when the dataProvider is static, there are no problems with the
 custom
  item
  renderer. However, when the dataProvider is dynamic, the height of the
 item
  renderer is not correct (and scroll bars appear for each renderer with
 any
  meaningful # of rows). I've set variableRowHeight=true for the List.
 I've
  also tried overriding the measure function and invaliding the size
 when a
  dataChange event is dispatched (based on information provided on
 FlexCoders
  in previous discussions along these lines).
 
  CommentRenderer.mxml:
 
  ?xml version=1.0 encoding=utf-8?
  mx:VBox xmlns:mx=http://www.adobe. http://www.adobe.com/2006/mxml
  com/2006/mxml width=100%
  mx:Script
  ![CDATA[
  override protected function measure():void
  {
  super.measure();
  measuredHeight = comment.textHeight;
  }
  ]]
  /mx:Script
  mx:LinkButton label={data.commenter.name}/
  mx:Text id=comment width=100% text={data.comment}
  dataChange=invalidateSize()/
  /mx:VBox
 
  The mx:List definition:
 
  mx:List id=comments itemRenderer=com.test.CommentRenderer
 width=100%
  height=100%/
 
  I've looked over the ListItemRenderer, but have so far been unable to
 glean
  the
  magic sauce that makes the item renderer function correctly when the
 control
  recycles. Can someone explain / provide a functional example(s) with
 mx:Text
  (ActionScript and MXML examples preferred, for completeness)?
 





[flexcoders] Re: Custom List ItemRenderer / Recycling troubles (height incorrect)

2009-04-18 Thread Tim Hoff

Hi,

Yes, after playing with it a little, you're correct; my suggestion only
works in AS.  Sorry, I always extend UIComponent for itemRenderers that
need to have a variableRowHeight.

BTW, in the future, please sign your posts; so that we can put a name to
your warm and positive comments.

-TH

--- In flexcoders@yahoogroups.com, wubac1 wub...@... wrote:

 Tim, I have been using the variableRowHeight (see my original
example). Also, one should not need to replicate the measure of mx:Text.
Your example disregards internal padding elements of the Text component.
I did try setActualSize combined with getExplicitOrMeasuredHeight, but
that only works in ActionScript. I encourage you to try and create a
functional example. I'm fairly confident at this point that you will not
get one working in MXML with mx:Text (multi-line).

 I was able to get a fully functional item renderer based on
ListItemRenderer, which uses UITextField. However, in theory, one should
be able to do it in MXML. With that in mind, I replaced the UITextField
of my ActionScript-based renderer with mx:Text. It's probably not
surprising to many that the renderer no longer behaves as expected. The
height issue appears to be tied to the component in some fashion
(mx:Text in this case). I'd file a defect but I haven't seen much ROI in
such reports.

 --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote:
 
 
  Hi,
 
  Set the List's variableRowHeight=true and use something like this
in
  the itemRenderer:
 
  override protected function measure():void
  {
  var textLineMetrics:TextLineMetrics = comment.measureText(
  comment.text );
 
  // should add paddingTop, paddingBottom and verticalGap to this too
  measuredHeight = textLineMetrics.height + myLinkButton.height;
  }
 
  -TH
 
  --- In flexcoders@yahoogroups.com, Tracy Spratt tracy@ wrote:
  
   Sorry, no magic sauce here. I had some pixie dust somewhere, but.
Was
  it
   Asimov or Clark that said, Any sufficiently advanced technology
is
   indistinguishable from magic?
  
  
  
   When I needed a variable height renderer, I copied
ListItemRenderer
  and
   modified to my needs. That was the only way I could get it to
work. It
  is
   also *much* more performant than a container based renderer. The
magic
  is
   indeed in the measure() function.
  
  
  
   If you do not have a lot of items to renderer, Repeater works well
  with
   variable heights.
  
  
  
   Tracy Spratt,
  
   Lariat Services, development services available
  
   _
  
   From: flexcoders@yahoogroups.com
[mailto:flexcod...@yahoogroups.com]
  On
   Behalf Of wubac1
   Sent: Saturday, April 18, 2009 2:02 AM
   To: flexcoders@yahoogroups.com
   Subject: [flexcoders] Custom List ItemRenderer / Recycling
troubles
  (height
   incorrect)
  
  
  
  
  
  
  
  
   I'm attempting to create a very simple item renderer for mx:List.
I've
  found
   that when the dataProvider is static, there are no problems with
the
  custom
   item
   renderer. However, when the dataProvider is dynamic, the height of
the
  item
   renderer is not correct (and scroll bars appear for each renderer
with
  any
   meaningful # of rows). I've set variableRowHeight=true for the
List.
  I've
   also tried overriding the measure function and invaliding the size
  when a
   dataChange event is dispatched (based on information provided on
  FlexCoders
   in previous discussions along these lines).
  
   CommentRenderer.mxml:
  
   ?xml version=1.0 encoding=utf-8?
   mx:VBox xmlns:mx=http://www.adobe.
http://www.adobe.com/2006/mxml
   com/2006/mxml width=100%
   mx:Script
   ![CDATA[
   override protected function measure():void
   {
   super.measure();
   measuredHeight = comment.textHeight;
   }
   ]]
   /mx:Script
   mx:LinkButton label={data.commenter.name}/
   mx:Text id=comment width=100% text={data.comment}
   dataChange=invalidateSize()/
   /mx:VBox
  
   The mx:List definition:
  
   mx:List id=comments itemRenderer=com.test.CommentRenderer
  width=100%
   height=100%/
  
   I've looked over the ListItemRenderer, but have so far been unable
to
  glean
   the
   magic sauce that makes the item renderer function correctly when
the
  control
   recycles. Can someone explain / provide a functional example(s)
with
  mx:Text
   (ActionScript and MXML examples preferred, for completeness)?
  
 






RE: [flexcoders] Re: Custom List ItemRenderer / Recycling troubles (height incorrect)

2009-04-18 Thread Tracy Spratt
Hah, Tim, your spell didn't quite do it, huh? ;)  Container-based renderers
are problematic.  For anything even slightly complex, extend UIComponent.

 

I copy ListItemRenderer, it is a great starting point.  It is pretty easy to
see where to add your special incantations.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Tim Hoff
Sent: Saturday, April 18, 2009 5:27 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Custom List ItemRenderer / Recycling troubles
(height incorrect)

 







Hi,

Yes, after playing with it a little, you're correct; my suggestion only
works in AS. Sorry, I always extend UIComponent for itemRenderers that
need to have a variableRowHeight.

BTW, in the future, please sign your posts; so that we can put a name to
your warm and positive comments.

-TH

--- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com,
wubac1 wub...@... wrote:

 Tim, I have been using the variableRowHeight (see my original
example). Also, one should not need to replicate the measure of mx:Text.
Your example disregards internal padding elements of the Text component.
I did try setActualSize combined with getExplicitOrMeasuredHeight, but
that only works in ActionScript. I encourage you to try and create a
functional example. I'm fairly confident at this point that you will not
get one working in MXML with mx:Text (multi-line).

 I was able to get a fully functional item renderer based on
ListItemRenderer, which uses UITextField. However, in theory, one should
be able to do it in MXML. With that in mind, I replaced the UITextField
of my ActionScript-based renderer with mx:Text. It's probably not
surprising to many that the renderer no longer behaves as expected. The
height issue appears to be tied to the component in some fashion
(mx:Text in this case). I'd file a defect but I haven't seen much ROI in
such reports.

 --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com,
Tim Hoff TimHoff@ wrote:
 
 
  Hi,
 
  Set the List's variableRowHeight=true and use something like this
in
  the itemRenderer:
 
  override protected function measure():void
  {
  var textLineMetrics:TextLineMetrics = comment.measureText(
  comment.text );
 
  // should add paddingTop, paddingBottom and verticalGap to this too
  measuredHeight = textLineMetrics.height + myLinkButton.height;
  }
 
  -TH
 
  --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
ups.com, Tracy Spratt tracy@ wrote:
  
   Sorry, no magic sauce here. I had some pixie dust somewhere, but.
Was
  it
   Asimov or Clark that said, Any sufficiently advanced technology
is
   indistinguishable from magic?
  
  
  
   When I needed a variable height renderer, I copied
ListItemRenderer
  and
   modified to my needs. That was the only way I could get it to
work. It
  is
   also *much* more performant than a container based renderer. The
magic
  is
   indeed in the measure() function.
  
  
  
   If you do not have a lot of items to renderer, Repeater works well
  with
   variable heights.
  
  
  
   Tracy Spratt,
  
   Lariat Services, development services available
  
   _
  
   From: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
ups.com
[mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com]
  On
   Behalf Of wubac1
   Sent: Saturday, April 18, 2009 2:02 AM
   To: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com
   Subject: [flexcoders] Custom List ItemRenderer / Recycling
troubles
  (height
   incorrect)
  
  
  
  
  
  
  
  
   I'm attempting to create a very simple item renderer for mx:List.
I've
  found
   that when the dataProvider is static, there are no problems with
the
  custom
   item
   renderer. However, when the dataProvider is dynamic, the height of
the
  item
   renderer is not correct (and scroll bars appear for each renderer
with
  any
   meaningful # of rows). I've set variableRowHeight=true for the
List.
  I've
   also tried overriding the measure function and invaliding the size
  when a
   dataChange event is dispatched (based on information provided on
  FlexCoders
   in previous discussions along these lines).
  
   CommentRenderer.mxml:
  
   ?xml version=1.0 encoding=utf-8?
   mx:VBox xmlns:mx=http://www.adobe.
http://www.adobe. http://www.adobe.com/2006/mxml com/2006/mxml
   com/2006/mxml width=100%
   mx:Script
   ![CDATA[
   override protected function measure():void
   {
   super.measure();
   measuredHeight = comment.textHeight;
   }
   ]]
   /mx:Script
   mx:LinkButton label={data.commenter.name}/
   mx:Text id=comment width=100% text={data.comment}
   dataChange=invalidateSize()/
   /mx:VBox
  
   The mx:List definition:
  
   mx:List id=comments itemRenderer=com.test.CommentRenderer
  width=100%
   height=100%/
  
   I've looked over the ListItemRenderer, but have so far been unable
to
  glean
   the
   magic sauce that makes

[flexcoders] Re: Custom List ItemRenderer / Recycling troubles (height incorrect)

2009-04-18 Thread Tim Hoff

Yep, no magic here. :)

-TH

--- In flexcoders@yahoogroups.com, Tracy Spratt tr...@... wrote:

 Hah, Tim, your spell didn't quite do it, huh? ;) Container-based
renderers
 are problematic. For anything even slightly complex, extend
UIComponent.



 I copy ListItemRenderer, it is a great starting point. It is pretty
easy to
 see where to add your special incantations.



 Tracy Spratt,

 Lariat Services, development services available

 _

 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com]
On
 Behalf Of Tim Hoff
 Sent: Saturday, April 18, 2009 5:27 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: Custom List ItemRenderer / Recycling
troubles
 (height incorrect)









 Hi,

 Yes, after playing with it a little, you're correct; my suggestion
only
 works in AS. Sorry, I always extend UIComponent for itemRenderers that
 need to have a variableRowHeight.

 BTW, in the future, please sign your posts; so that we can put a name
to
 your warm and positive comments.

 -TH

 --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
ups.com,
 wubac1 wubac1@ wrote:
 
  Tim, I have been using the variableRowHeight (see my original
 example). Also, one should not need to replicate the measure of
mx:Text.
 Your example disregards internal padding elements of the Text
component.
 I did try setActualSize combined with getExplicitOrMeasuredHeight, but
 that only works in ActionScript. I encourage you to try and create a
 functional example. I'm fairly confident at this point that you will
not
 get one working in MXML with mx:Text (multi-line).
 
  I was able to get a fully functional item renderer based on
 ListItemRenderer, which uses UITextField. However, in theory, one
should
 be able to do it in MXML. With that in mind, I replaced the
UITextField
 of my ActionScript-based renderer with mx:Text. It's probably not
 surprising to many that the renderer no longer behaves as expected.
The
 height issue appears to be tied to the component in some fashion
 (mx:Text in this case). I'd file a defect but I haven't seen much ROI
in
 such reports.
 
  --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
ups.com,
 Tim Hoff TimHoff@ wrote:
  
  
   Hi,
  
   Set the List's variableRowHeight=true and use something like
this
 in
   the itemRenderer:
  
   override protected function measure():void
   {
   var textLineMetrics:TextLineMetrics = comment.measureText(
   comment.text );
  
   // should add paddingTop, paddingBottom and verticalGap to this
too
   measuredHeight = textLineMetrics.height + myLinkButton.height;
   }
  
   -TH
  
   --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
 ups.com, Tracy Spratt tracy@ wrote:
   
Sorry, no magic sauce here. I had some pixie dust somewhere,
but.
 Was
   it
Asimov or Clark that said, Any sufficiently advanced technology
 is
indistinguishable from magic?
   
   
   
When I needed a variable height renderer, I copied
 ListItemRenderer
   and
modified to my needs. That was the only way I could get it to
 work. It
   is
also *much* more performant than a container based renderer. The
 magic
   is
indeed in the measure() function.
   
   
   
If you do not have a lot of items to renderer, Repeater works
well
   with
variable heights.
   
   
   
Tracy Spratt,
   
Lariat Services, development services available
   
_
   
From: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
 ups.com
 [mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
ups.com]
   On
Behalf Of wubac1
Sent: Saturday, April 18, 2009 2:02 AM
To: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
ups.com
Subject: [flexcoders] Custom List ItemRenderer / Recycling
 troubles
   (height
incorrect)
   
   
   
   
   
   
   
   
I'm attempting to create a very simple item renderer for
mx:List.
 I've
   found
that when the dataProvider is static, there are no problems with
 the
   custom
item
renderer. However, when the dataProvider is dynamic, the height
of
 the
   item
renderer is not correct (and scroll bars appear for each
renderer
 with
   any
meaningful # of rows). I've set variableRowHeight=true for the
 List.
   I've
also tried overriding the measure function and invaliding the
size
   when a
dataChange event is dispatched (based on information provided on
   FlexCoders
in previous discussions along these lines).
   
CommentRenderer.mxml:
   
?xml version=1.0 encoding=utf-8?
mx:VBox xmlns:mx=http://www.adobe.
 http://www.adobe. http://www.adobe.com/2006/mxml com/2006/mxml
com/2006/mxml width=100%
mx:Script
![CDATA[
override protected function measure():void
{
super.measure();
measuredHeight = comment.textHeight;
}
]]
/mx:Script
mx:LinkButton label={data.commenter.name}/
mx:Text id=comment width=100% text={data.comment}
dataChange=invalidateSize()/
/mx:VBox

[flexcoders] Re: Custom List ItemRenderer / Recycling troubles (height incorrect)

2009-04-18 Thread wubac1

Well, there is magic in ActionScript.  MXML doesn't have the item renderer mojo.

-W

--- In flexcoders@yahoogroups.com, Tim Hoff timh...@... wrote:

 
 Yep, no magic here. :)
 
 -TH
 
 --- In flexcoders@yahoogroups.com, Tracy Spratt tracy@ wrote:
 
  Hah, Tim, your spell didn't quite do it, huh? ;) Container-based
 renderers
  are problematic. For anything even slightly complex, extend
 UIComponent.
 
 
 
  I copy ListItemRenderer, it is a great starting point. It is pretty
 easy to
  see where to add your special incantations.
 
 
 
  Tracy Spratt,
 
  Lariat Services, development services available
 
  _
 
  From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com]
 On
  Behalf Of Tim Hoff
  Sent: Saturday, April 18, 2009 5:27 PM
  To: flexcoders@yahoogroups.com
  Subject: [flexcoders] Re: Custom List ItemRenderer / Recycling
 troubles
  (height incorrect)
 
 
 
 
 
 
 
 
 
  Hi,
 
  Yes, after playing with it a little, you're correct; my suggestion
 only
  works in AS. Sorry, I always extend UIComponent for itemRenderers that
  need to have a variableRowHeight.
 
  BTW, in the future, please sign your posts; so that we can put a name
 to
  your warm and positive comments.
 
  -TH
 
  --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
 ups.com,
  wubac1 wubac1@ wrote:
  
   Tim, I have been using the variableRowHeight (see my original
  example). Also, one should not need to replicate the measure of
 mx:Text.
  Your example disregards internal padding elements of the Text
 component.
  I did try setActualSize combined with getExplicitOrMeasuredHeight, but
  that only works in ActionScript. I encourage you to try and create a
  functional example. I'm fairly confident at this point that you will
 not
  get one working in MXML with mx:Text (multi-line).
  
   I was able to get a fully functional item renderer based on
  ListItemRenderer, which uses UITextField. However, in theory, one
 should
  be able to do it in MXML. With that in mind, I replaced the
 UITextField
  of my ActionScript-based renderer with mx:Text. It's probably not
  surprising to many that the renderer no longer behaves as expected.
 The
  height issue appears to be tied to the component in some fashion
  (mx:Text in this case). I'd file a defect but I haven't seen much ROI
 in
  such reports.
  
   --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
 ups.com,
  Tim Hoff TimHoff@ wrote:
   
   
Hi,
   
Set the List's variableRowHeight=true and use something like
 this
  in
the itemRenderer:
   
override protected function measure():void
{
var textLineMetrics:TextLineMetrics = comment.measureText(
comment.text );
   
// should add paddingTop, paddingBottom and verticalGap to this
 too
measuredHeight = textLineMetrics.height + myLinkButton.height;
}
   
-TH
   
--- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
  ups.com, Tracy Spratt tracy@ wrote:

 Sorry, no magic sauce here. I had some pixie dust somewhere,
 but.
  Was
it
 Asimov or Clark that said, Any sufficiently advanced technology
  is
 indistinguishable from magic?



 When I needed a variable height renderer, I copied
  ListItemRenderer
and
 modified to my needs. That was the only way I could get it to
  work. It
is
 also *much* more performant than a container based renderer. The
  magic
is
 indeed in the measure() function.



 If you do not have a lot of items to renderer, Repeater works
 well
with
 variable heights.



 Tracy Spratt,

 Lariat Services, development services available

 _

 From: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
  ups.com
  [mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
 ups.com]
On
 Behalf Of wubac1
 Sent: Saturday, April 18, 2009 2:02 AM
 To: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
 ups.com
 Subject: [flexcoders] Custom List ItemRenderer / Recycling
  troubles
(height
 incorrect)








 I'm attempting to create a very simple item renderer for
 mx:List.
  I've
found
 that when the dataProvider is static, there are no problems with
  the
custom
 item
 renderer. However, when the dataProvider is dynamic, the height
 of
  the
item
 renderer is not correct (and scroll bars appear for each
 renderer
  with
any
 meaningful # of rows). I've set variableRowHeight=true for the
  List.
I've
 also tried overriding the measure function and invaliding the
 size
when a
 dataChange event is dispatched (based on information provided on
FlexCoders
 in previous discussions along these lines).

 CommentRenderer.mxml:

 ?xml version=1.0 encoding=utf-8?
 mx:VBox xmlns:mx=http://www.adobe.
  http://www.adobe. http://www.adobe.com/2006/mxml com/2006/mxml