views:

122

answers:

1

How could i disable the selection color on single click and enable it just to double click.

A: 

Flex 3 answer...

You'll need to extend the Tree class and override the drawItem method to remove the highlight child that is added.

It's as easy as

protected override function drawItem( item : IListItemRenderer, selected:Boolean = false, highlighted : Boolean = false, caret : Boolean = false, transition : Boolean = false ) : void {
    super.drawItem( item, selected, false, caret, transition );
}

Then add listeners for clicks and doubleclicks that replicate the functionality of the highlight code you prevented happening in the overridden method.

Note this doesn't stop the row actually being selected, it just alters the highlight, so it may be a bit confusing for users to have the highlight missing but still have a row selected.

Gregor Kiddie
seems exactly what i need, i just need to prevent selected color from appearing on click, because selection in my application just with double click, could you please explain the other thing i need to do more accurate.. tnanks
seismael
You know this isn't stopping the selection... just the highlight? If you single click the item is still getting added to the Tree's selectedItems array.
Gregor Kiddie