我怎样才能得到一个DataGrid表现得像Ctrl键处于活动状态? [英] How can I get a datagrid to behave like the ctrl key is active?

查看:104
本文介绍了我怎样才能得到一个DataGrid表现得像Ctrl键处于活动状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的数据网格的行为在默认情况下,如果用户持有control键。因此,一个项目被点击时,那么其他项目,他们是选择的两个部分,点击它们再次从选择中删除。

I want my data grid to behave by default as if the user is holding the control key down. So when an item is clicked, then another item they are both part of the selection, clicking them again removes them from the selection.

我已经有 allowMultipleSelection = TRUE ,但我似乎无法找到,这是否任何设置。我工作在此期间itemClick事件,但似乎有可能是一个简单易用的设置我失踪。

I already have allowMultipleSelection = true but I can't seem to find any setting that does this. I'm working on the itemclick event in the meantime, but it seems like there might be an easy to use setting I'm missing.

有什么想法?

推荐答案

您也可以扩展DataGrid和覆盖选择信息的方法,像这样:

You could also extend DataGrid and override the selectItem method like so:

override protected function selectItem(item:IListItemRenderer, shiftKey:Boolean, ctrlKey:Boolean, transition:Boolean = true):Boolean
{
    return super.selectItem(item, shiftKey, true, transition )
}

减code,不太可能有可能被监听了的MouseEvent其他因素的影响。

Less code and less likely to have impact on other elements that might be listening for that MouseEvent.

这篇关于我怎样才能得到一个DataGrid表现得像Ctrl键处于活动状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆