1. Are there any known issues with extending Label for item renderers? No, but it's rare. 2. Assuming that the item renderer only needs to manipulate the text of the renderer, is example 1 - extending DataItemGrid - (below) a good way to do it? (I've never written one before, so I'm just checking) No, for text only, use a labelFunction; instead of a custom itemRenderer. 3. Is there anything else wrong with the example 1 below / a better way? Better to handle the calcs in commitProperties. -TH
--- In [email protected], tom s <tcs2...@...> wrote: > > Problem solved. But is was bizarre, so I'll explain. Also, I still have one > or two questions, but mainly for education now... > > First, I set the visible property of the dataGrid to false. I then check the > redraw region and never saw the area that was causing trouble before. So I > figured it was probably something in the dataGrid. The item renderers being > prime suspect, as I wrote them.. > > I put it back to visible = true, and played some more. I discovered that the > problem didnt manifest itself at first, only after a fair amount of mouse > activity over the dataGrid. Maybe a memory leak in my item renderer? > > Then I looked at Alex Harui's blog, and saw that I could/ should be > extending DataGridItemRenderer. I did that, and all seems fine now. The > speed at which the dataGrid appearance keeps up with the mouse movements > over it is 10x faster than before. > > My questions: > > 1. Are there any known issues with extending Label for item renderers? > 1b. What's wrong with example 2 - extending Label - (below)? > 2. Assuming that the item renderer only needs to manipulate the text of the > renderer, is example 1 - extending DataItemGrid - (below) a good way to do > it? (I've never written one before, so I'm just checking) > 3. Is there anything else wrong with the example 1 below / a better way? > > > thanks > > tom > > ******************* example 1 ******************** > > package com.*** > { > import mx.controls.dataGridClasses.DataGridItemRenderer; > > public class LengthRenderer extends DataGridItemRenderer > { > override public function set data(value:Object):void > { > super.data = value; > if(value!= null && value.length != null) { > this.invalidateProperties(); > } > } > > override public function validateProperties():void > { > super.validateProperties(); > var mins:int = Math.floor(data.length/60) > var secs:String = (data.length - mins).toString() > if (secs.length == 1){secs = "0" + secs} > this.text = mins.toString()+":"+secs > } > } > } > > ******************* example 2 *********************** > > package com.*** > { > > > import mx.controls.Label; > > public class LengthRenderer extends Label > { > override public function set data(value:Object):void > { > super.data = value; > if(value!= null && value.length != null) { > this.invalidateDisplayList(); > } > } > > override protected function > updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void > { > var mins:int = Math.floor(data.length/60) > var secs:String = (data.length - mins).toString() > if (secs.length == 1){secs = "0" + secs} > this.text = mins.toString()+":"+secs > > > > > > } > } > } > > --- In [email protected], "Tim Hoff" TimHoff@ wrote: > > > > > > Has to be another object on top of the DataGrid. The redraw region is > > the clue. Look at the other objects in the same class as the DataGrid. > > > > -TH > > > > --- In [email protected], "Tracy Spratt" <tspratt@> wrote: > > > > > > If you are pretty sure there is not something invisible covering that > > area, > > > try cleaning the project. > > > > > > Tracy > > > > > > > > > > > > _____ > > > > > > From: [email protected] [mailto:[email protected]] > > On > > > Behalf Of tom s > > > Sent: Saturday, March 07, 2009 6:31 PM > > > To: [email protected] > > > Subject: [flexcoders] dataGrid not receiving user input > > (intermitently) in > > > bottom right > > > > > > > > > > > > I have a datagrid that works ~50% of the time. > > > > > > The other 50% of the time the dataGrid wont accept user interaction in > > the > > > bottom right area (the bottom 3 (of 6) rows, right 2 (of 4) columns). > > > > > > i.e. that part of the grid does not react to mouse over events, not > > mouse > > > click events. > > > > > > Sometimes is reacts to click events as if they are occurring in the > > row in > > > which a mouse_over interaction was last observed. > > > > > > > > > > > > Looking at the redraw regions, I see that a redraw region occasionally > > > appears in the bottom right of the grid - exactly where he grid is not > > > receiving user input. > > > > > > So that is probably related. > > > > > > But I don't know what it is a redraw region for. I've checked my other > > > component and they aren't near. > > > > > > > > > > > > I have the following custom item renderers: > > > > > > column 2: extends Canvas > > > > > > column 3: extends Label > > > > > > column 4: extends Label. > > > > > > > > > > > > Anyone know what might be causing this? > > > > > > Or how to fix it / diagnose it further? > > > > > > > > > > > > thanks > > > > > > > > > > > > tom > > > > > >

