--- In [email protected], "Richard Baker" <[EMAIL PROTECTED]> 
wrote:
>
> Hi
> 
> I have a DataGrid with 1 column - which is a custom itemRenderer.
> That's built from an MXML component file containing a VBox and 3 
text
> boxes stacked vertically (obviously!). Each line should be displayed
> without scrollbars - variableRowHeight is set to true on the 
datagrid.
> 
> Problem is, each line's height seems to be set to a seemingly random
> value. Sometimes it works, sometimes not. I think its to do with
> itemRenderer recycling, so I am trying to explicitly set the VBox
> height with a dataChange event handler:
> 
> private function onDataChange():void
> {
>       txtQuestion.validateNow();
>       txtOption.validateNow();
>       txtFeedback.validateNow();
>       this.height= txtQuestion.textHeight+txtOption.textHeight+
> txtFeedback.textHeight;
>       trace ("ondatachange :" + txtQuestion.text + this.height);
        
> }
> 
> the heights of the text fields (txtQuestion etc) don't seem to be
> right so I am calling the validateNow to try to get the correct 
value,
> but it's not happening for me?
> 
> Where am I going wrong?
> 

There may be some race conditions going on regarding properties and 
dimensions, so you might want to override measure() to ensure that 
you properly report the measuredHeight and measuredWidth to the 
container.  This would also allow you to avoid calling validateNow() 
so many times, which is an expensive operation, as I understand it.  
Since you're already using a heavy component to extend, you probably 
want to optimize your performance as much as possible.

Since you don't want scrollbars, you might want to use UIComponent 
and just size and position your child components in updateDisplayList.

HTH;

Amy

Reply via email to