Tree Scroll Issue

1123
3
05-28-2010 10:57 AM
CaseyBentz
Occasional Contributor II
I have found that I am having trouble with a tree using a custom itemrenderer that implements a treeitemrenderer.  What is happening is that when I use the mouse wheel to scroll, the tree scrolls up and down, but the item that I am hovering over also scrolls.  I am have the tree variableRowHeight set true and the wordWrap of the label of the treeItemRenderer set to true.  An example would be:

Below Milner Dam
Whitewater Put-In

Turns into
Whitewater Put-In
'blank space'

I have tried to set the vertical scroll policy of the custom itemRenderer to off, but no luck
super.setConstraintValue("verticalScrollPolicy", ScrollPolicy.OFF);

Any ideas?

Casey
Tags (2)
0 Kudos
3 Replies
CaseyBentz
Occasional Contributor II
here is my custom itemRenderer

// ActionScript file
package com.utils
{
import mx.controls.treeClasses.TreeItemRenderer;
import mx.core.ScrollPolicy;

public class TreeItemDataDependantLabelRenderer extends TreeItemRenderer
{
  public function TreeItemDataDependantLabelRenderer()
  {
   super();
  }
  override protected function commitProperties():void
  {
   super.commitProperties();
   if(data != null){
    if (data is Region){
     setStyle("fontWeight" , "bold");
     setStyle("color", "#75A140");
     label.wordWrap = true;
     super.setConstraintValue("textIndent", 5);
    }
    else{
     setStyle("fontWeight" , "bold");
     setStyle("color", "#447D9C");
     label.wordWrap = true;
     super.setConstraintValue("textIndent", 0);
    }
   }
  }
}
}
0 Kudos
CaseyBentz
Occasional Contributor II
Here is my tree

<!--Control for the list of parks-->
     <mx:VBox id="listBox" height="100%" width="100%" styleName="ListBox" paddingTop="0" paddingBottom="0">
      <mx:Tree id="parkTree" height="533" width="200" styleName="Tree"
       paddingBottom="0" paddingTop="0"
       dataProvider="{parkData}" labelField="name"
       itemRenderer="com.utils.TreeItemDataDependantLabelRenderer"
       itemClick="listMouseClick(event);" variableRowHeight="true"/>
     </mx:VBox>
0 Kudos
CaseyBentz
Occasional Contributor II
I found the solution, and it isn't even a hack.

in the custom itemRender, I added this line:

label.mouseWheelEnabled = false;

All is good.:D

Casey
0 Kudos