Flex 4: mx | Tree how can I turn off hover and selection colors?

this is the second question related to my first question:

Flex 4: mx | tree - how can I turn off the selection of elements?

I want to turn off the hover and selection colors, so when the user selects an element whose background does not change color. how is this possible?

Update

I do not want to select highlight colors and colors. the background contains an image, so it will not be useful. I need to completely disable the colors.

another update

I tried to override the Tree class, but no luck.

this is the class that overrides the tree. Grade:

package components.popups.WelcomeBack {
import mx.controls.listClasses.IListItemRenderer;
import mx.controls.Tree;

/**
 * @author ufk
 */
public class TreeNoSelection extends Tree {

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

}


}

and this is my actual tree component:

<?xml version="1.0" encoding="utf-8"?>
<WelcomeBack:TreeNoSelection xmlns:fx="http://ns.adobe.com/mxml/2009" 
     xmlns:s="library://ns.adobe.com/flex/spark" 
     xmlns:mx="library://ns.adobe.com/flex/mx"
     xmlns:WelcomeBack="components.popups.WelcomeBack.*" folderClosedIcon="{null}" defaultLeafIcon="{null}"
     folderOpenIcon="{null}" 
     showRoot="false"  
            allowMultipleSelection="false" allowDragSelection="false" labelField="@label">
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

<fx:Script>
    <![CDATA[
        import ItemRenderer.WelcomeBackTreeItemRenderer;
        private var _themeLibrary:Object;

        public function get themeLibrary():Object {
            return this._themeLibrary;
        }

        public function set themeLibrary(tl:Object):void {
            this._themeLibrary=tl;
            var cf:ClassFactory = new ClassFactory();
            cf.generator = ItemRenderer.WelcomeBackTreeItemRenderer;
            cf.properties = {
                _themeLibrary:this._themeLibrary
            };
            this.itemRenderer=cf;
        }

    ]]>
</fx:Script>

</WelcomeBack:TreeNoSelection>

thank

+3
source share
3 answers

. , . , .

package custom
{
    import mx.controls.Tree;
    import mx.controls.listClasses.IListItemRenderer;

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

    }
}

, , , drawItem , , , , "". . , , false, - , .

Edit

, , - , , , (, , , :

public class CustomTree extends Tree
{
    public override function isItemShowingCaret(data:Object):Boolean
    {
        return false;
    }

    public override function isItemHighlighted(data:Object):Boolean
    {
        return false;
    }

    public override function isItemSelected(data:Object):Boolean
    {
        return false;
    }

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

- isItemSelectable ( , ):

public override function isItemSelectable(data:Object):Boolean
{
     return false;
}
+4

rollOverColor selectionColor. , inline , .

<mx:Tree rollOverColor="#FFFFFF" selectionColor="#FFFFFF"
+3

, 4- jss-:

<mx:Tree rollOverColor="#00FFFFFF" selectionColor="#00FFFFFF"

... - ( ) .

+3

Source: https://habr.com/ru/post/1791220/


All Articles