开发者

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 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜