I would start with UIComponent.  You probably don't need much in LIR.
In fact, I'd make a copy of LIR and rename it and erase the guts of
createChildren, commitProperties, measure, and updateDisplayList.  You
shouldn't need to touch getters/setters of data/listData.

Create the textfields in createChildren.

Stuff the .text properties from the data object in commitProperties

Calc measuredHeight in measure() something like this:

Override protected function measure()
{
        Tf1.width = explicitWidth * .2;
        Tf2.width = explicitWidth * .8;
        measuredHeight = Math.max(tf1.textHeight, tf2.textHeight);
        measuredHeight += (some padding)
}

Set their final positions in UDL

Good luck.  This is hairy-level-one so there are no dumb questions.

-Alex

PS:  listData is part of IDropInListItemRenderer, which could allow this
renderer to pick and choose its properties based on which column it is
in.


-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of David Ham
Sent: Monday, September 10, 2007 8:27 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: Unwanted scrollbars on my List
itemRenderer--measure() help?

Sorry to be obtuse, but this is still giving me problems...

(BTW Many thanks Alex for looking into the image issue, that's very  
helpful)

So I have a renderer that will have a few textfields, and I want to  
extend ListItemRenderer. The rows will be of different heights due to  
different amounts of text in the textfields, and the item renderer  
should not display a scrollbar of any kind. My questions:

1) Where should I set the ".text" values for my textfields--that is,  
what actually displays? Do I set it in set data() or in  
commitProperties()?

2) How much of ListItemRenderer's methods should I override? It looks  
like I need to do most of them--createChildren() to create my  
textfields, commitProperties() to set all their values (or do I--see  
1), measure() to get the sizes, updateDisplayList() to lay everything  
out, and get and set data(). Do I need to call super.methodName() on  
all these? If so, what does extending ListItemRenderer get me that I  
couldn't get by writing a custom UIComponent?

3) I had been thinking of get and set data() as ways of referring to  
the object being listed, where _data is an instance of the value  
object I am listing. Is this right? What is listData?

Thanks for not having called me a dumbass so far, at least not out loud,

OK
DAH


On Sep 7, 2007, at 5:47 PM, Alex Harui wrote:

>
> Yes, you should deal with listData in commitProperties or later.   
> That's why it is only one level of hairy.
>
> From: flexcoders@yahoogroups.com  
> [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Spratt
> Sent: Friday, September 07, 2007 3:08 PM
> To: flexcoders@yahoogroups.com
> Subject: RE: [flexcoders] Re: Unwanted scrollbars on my List  
> itemRenderer--measure() help?
>
>
> "listData is available when ... commitProperties runs" and  
> commitProperties runs after set data(), yes? So if a renderer needs  
> to use listData, it should do that work in commitProperties.   
> Right? That clears up some questions I had about ListItemRenderer.
>
> That's 0.2 orders of magnitude less hairy.
>
> Tracy
>
> From: flexcoders@yahoogroups.com  
> [mailto:[EMAIL PROTECTED] On Behalf Of Alex Harui
> Sent: Friday, September 07, 2007 5:52 PM
> To: flexcoders@yahoogroups.com
> Subject: RE: [flexcoders] Re: Unwanted scrollbars on my List  
> itemRenderer--measure() help?
>
> The "rules" are:
>
> listData is set for you and should never be modified by the renderer.
>
> listData is available when the dataChange event fires or  
> commitProperties runs
>
> explicitWidth should be set so use that to your advantage.
>
> Is there any way you can know by the url of the image what its  
> height will be?
>
> From: flexcoders@yahoogroups.com  
> [mailto:[EMAIL PROTECTED] On Behalf Of David Ham
> Sent: Friday, September 07, 2007 2:43 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Unwanted scrollbars on my List  
> itemRenderer--measure() help?
>
> > It should only be one level of hairy, not three...
>
> LOL. Sorry, I wax hyperbolic late in the day, when the caffeine has
> jacked me up and Flex has dragged me behind its car for a ways. I'll
> dig around in measure() and see what I can do.
>
> Do I need to worry about setting listData when I subclass
> ListItemRenderer? I am getting null object reference errors around  
> it...
>
> OK
> DAH
>
>
>
>
> 



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



Reply via email to