开发者

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

开发者 https://www.devze.com 2022-12-21 19:58 出处:网络
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 Sh开发者_Go百科ift).

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 Sh开发者_Go百科ift). If the user clicks a selected item a 2nd time, it will deselect it. Can anyone help me out?

Thanks!


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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消