RE: [flexcoders] Height Problems of List component using itemrenderer with different row height
Looks like I need to add another chapter to my blog about item renderers. Several folks have struggled with wordwrapping text in renderers. I strongly recommend taking the code from ListItemRenderer and working from there because: 1) It is in AS and so will be lighterweight than this nest of containers 2) it makes it easier to control scrollbars 3) It makes it easier to handle explicitWidth The lifecycle for renderers is different than for components in an MXML file. The renderer is instantiated and added to the display list (or recycledfrom the free list), assigned a .data item, given an explicitWidth and measured to determine its height. % width/height is ignored in the top-level containers and the measure method needs to respect the explicitWIdth property. It is much more top-down than for regular components which are measured from the bottom up. I hacked some values and binding into your example to get it to work. To generalize, you'd have to call getStyle() on horizontalGap and factor in the button's size. To me, it is always much cleaner just to write the AS code instead of having all of these containers. ?xml version=1.0 encoding=utf-8? mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; xmlns:view=* verticalScrollPolicy=off horizontalScrollPolicy=off mx:VBox id=testVBox width={explicitWidth} height=100% horizontalScrollPolicy=off mx:HBox width={explicitWidth} id=testHbox mx:VBox id=nameBox width={explicitWidth - 24} mx:Text id=testText text={data.label} selectable=false width={nameBox.explicitWidth}/ mx:Label id=testLabel text={data.data} truncateToFit=true selectable=false / /mx:VBox mx:Button id=testButton width=16 height=16 buttonMode=true/ /mx:HBox /mx:VBox /mx:Canvas However, in poking at this, your example did expose a bug that we'll try to squeeze into Flex 3 before it ships. The measureHeightOfItems does not factor in paddingLeft/Right. I had to set it to zero in the main app otherwise scrollbars popped up. HTH, -Alex From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Christoph Atteneder Sent: Friday, November 30, 2007 9:00 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Height Problems of List component using itemrenderer with different row height With the default renderer with wordWrap = true and variableRowHeight= true it works if I´m setting the height of the list after calling measureHeightOfItems(). But it is not working if you are using more sophisticated ItemRenderers( e.g. with VBox and multiple TextFields, Buttons,...) I´ve already uploaded a simple Example under www.cubeworx.net/ripcurlx/ResizeBug.zip http://www.cubeworx.net/ripcurlx/ResizeBug.zip br, Christoph On Nov 30, 2007 5:47 PM, Alex Harui [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: does it work with the default renderers with wordWrap=true and variableRowHeight=true? From: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com ] On Behalf Of Christoph Atteneder Sent: Friday, November 30, 2007 7:43 AM To: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com Subject: [flexcoders] Height Problems of List component using itemrenderer with different row height Hi, My problem is following: I have a List component which is filled with a list of properties and I want to know how much space it needs to display all of its items. This only works with single label renderer or renderer with a fixed height, but not with renderer with different row height with Text component. I really have big problems with all releases of the flex 3 framework so far regarding this issue. I´ve uploaded a flex builder project for testing. www.cubeworx.net/ripcurlx/ResizeBug.zip http://www.cubeworx.net/ripcurlx/ResizeBug.zip This text wrap size problem is critical for my application, so I hope there is at least a workaround for this issue. thx for any hints in advance br, Christoph
Re: [flexcoders] Height Problems of List component using itemrenderer with different row height
Hi, I also already tried this workaround, but still getting from time to time during resizing the same bug. I´ve added a bug in the adobe bug base for this: *SDK-13813 https://bugs.adobe.com/jira/browse/SDK-13813 *Hopefully there will be a bug fix in the next release or at least a workaround which works all the time. cheers, Christoph* * On Nov 30, 2007 7:55 PM, Alex Harui [EMAIL PROTECTED] wrote: Not sure when I'll get time to look. The basic trick to getting multiline to work is to set the explicitWidth/width of the text widget so it can define its height correctly. The explicitWidth of the renderer is set by the list class before the renderer's measure() is called. -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Christoph Atteneder *Sent:* Friday, November 30, 2007 9:00 AM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Height Problems of List component using itemrenderer with different row height With the default renderer with wordWrap = true and variableRowHeight= true it works if I´m setting the height of the list after calling measureHeightOfItems(). But it is not working if you are using more sophisticated ItemRenderers( e.g. with VBox and multiple TextFields, Buttons,...) I´ve already uploaded a simple Example under www.cubeworx.net/ripcurlx/ResizeBug.zip br, Christoph On Nov 30, 2007 5:47 PM, Alex Harui [EMAIL PROTECTED] wrote: does it work with the default renderers with wordWrap=true and variableRowHeight=true? -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Christoph Atteneder *Sent:* Friday, November 30, 2007 7:43 AM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Height Problems of List component using itemrenderer with different row height Hi, My problem is following: I have a List component which is filled with a list of properties and I want to know how much space it needs to display all of its items. This only works with single label renderer or renderer with a fixed height, but not with renderer with different row height with Text component. I really have big problems with all releases of the flex 3 framework so far regarding this issue. I´ve uploaded a flex builder project for testing. www.cubeworx.net/ripcurlx/ResizeBug.zip This text wrap size problem is critical for my application, so I hope there is at least a workaround for this issue. thx for any hints in advance br, Christoph
RE: [flexcoders] Height Problems of List component using itemrenderer with different row height
Not sure when I'll get time to look. The basic trick to getting multiline to work is to set the explicitWidth/width of the text widget so it can define its height correctly. The explicitWidth of the renderer is set by the list class before the renderer's measure() is called. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Christoph Atteneder Sent: Friday, November 30, 2007 9:00 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Height Problems of List component using itemrenderer with different row height With the default renderer with wordWrap = true and variableRowHeight= true it works if I´m setting the height of the list after calling measureHeightOfItems(). But it is not working if you are using more sophisticated ItemRenderers( e.g. with VBox and multiple TextFields, Buttons,...) I´ve already uploaded a simple Example under www.cubeworx.net/ripcurlx/ResizeBug.zip http://www.cubeworx.net/ripcurlx/ResizeBug.zip br, Christoph On Nov 30, 2007 5:47 PM, Alex Harui [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: does it work with the default renderers with wordWrap=true and variableRowHeight=true? From: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com ] On Behalf Of Christoph Atteneder Sent: Friday, November 30, 2007 7:43 AM To: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com Subject: [flexcoders] Height Problems of List component using itemrenderer with different row height Hi, My problem is following: I have a List component which is filled with a list of properties and I want to know how much space it needs to display all of its items. This only works with single label renderer or renderer with a fixed height, but not with renderer with different row height with Text component. I really have big problems with all releases of the flex 3 framework so far regarding this issue. I´ve uploaded a flex builder project for testing. www.cubeworx.net/ripcurlx/ResizeBug.zip http://www.cubeworx.net/ripcurlx/ResizeBug.zip This text wrap size problem is critical for my application, so I hope there is at least a workaround for this issue. thx for any hints in advance br, Christoph
RE: [flexcoders] Height Problems of List component using itemrenderer with different row height
does it work with the default renderers with wordWrap=true and variableRowHeight=true? From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Christoph Atteneder Sent: Friday, November 30, 2007 7:43 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Height Problems of List component using itemrenderer with different row height Hi, My problem is following: I have a List component which is filled with a list of properties and I want to know how much space it needs to display all of its items. This only works with single label renderer or renderer with a fixed height, but not with renderer with different row height with Text component. I really have big problems with all releases of the flex 3 framework so far regarding this issue. I´ve uploaded a flex builder project for testing. www.cubeworx.net/ripcurlx/ResizeBug.zip http://www.cubeworx.net/ripcurlx/ResizeBug.zip This text wrap size problem is critical for my application, so I hope there is at least a workaround for this issue. thx for any hints in advance br, Christoph
Re: [flexcoders] Height Problems of List component using itemrenderer with different row height
With the default renderer with wordWrap = true and variableRowHeight= true it works if I´m setting the height of the list after calling measureHeightOfItems(). But it is not working if you are using more sophisticated ItemRenderers(e.g. with VBox and multiple TextFields, Buttons,...) I´ve already uploaded a simple Example under www.cubeworx.net/ripcurlx/ResizeBug.zip br, Christoph On Nov 30, 2007 5:47 PM, Alex Harui [EMAIL PROTECTED] wrote: does it work with the default renderers with wordWrap=true and variableRowHeight=true? -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Christoph Atteneder *Sent:* Friday, November 30, 2007 7:43 AM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Height Problems of List component using itemrenderer with different row height Hi, My problem is following: I have a List component which is filled with a list of properties and I want to know how much space it needs to display all of its items. This only works with single label renderer or renderer with a fixed height, but not with renderer with different row height with Text component. I really have big problems with all releases of the flex 3 framework so far regarding this issue. I´ve uploaded a flex builder project for testing. www.cubeworx.net/ripcurlx/ResizeBug.zip This text wrap size problem is critical for my application, so I hope there is at least a workaround for this issue. thx for any hints in advance br, Christoph