erikcw
erikcw

Reputation: 11057

Select multiple items in Flex Tree control without pressing the Ctrl key?

I'm trying to modifty the Flex Tree control to allow a user to select multiple items by just clicking each of the desired elements (ie I don't want them to have to press Ctrl or Shift). If the user clicks a selected item a 2nd time, it will deselect it. Can anyone help me out?

Thanks!

Upvotes: 1

Views: 2397

Answers (2)

user723644
user723644

Reputation: 31

You can create a simple custom component of ur own. Here is the code:

package com { import flash.events.MouseEvent; import mx.controls.Tree;

public class ForceCtrlTree extends Tree
{
    override protected function mouseClickHandler(event:MouseEvent):void
    {
        event.ctrlKey = true;
        super.mouseClickHandler(event);
    }
    override protected function mouseDownHandler(event:MouseEvent):void
    {
        event.ctrlKey = true;
        super.mouseDownHandler(event);
    }
}

}

Import this package into your project. Then declare the tree component as follows:

Now you need not click ctrl to select multiple objects.

Upvotes: 0

invertedSpear
invertedSpear

Reputation: 11054

I just had to do this with a datagrid, since they are both based on list it will work for you too

How can I get a datagrid to behave like the ctrl key is active?

Upvotes: 2

Related Questions