powershell - PowerShell Out-GridView 处理 Click/DoubleClik 事件
问题描述
将数据发送到 GridView (Out-GridView) 后
如何创建处理行单击(行选择)的事件
或处理双击并关闭
在变量中提供所选行的 GridView 的事件
TIA
解决方案
不幸的是,我认为没有“行选择事件” Out-GridView
,也没有双击列表中项目的方法。
但是,此示例显示了如何使用Out-GridView
. 通过Out-GridView
CmdLet 管道传输数据并使用-PassThru
开关允许用户选择项目。PassThru
这意味着-Wait
挂起脚本并等待用户选择项目或关闭窗口:
$viewme = @('pick','one','of','these')
$selection = $viewme | Out-GridView -PassThru -Title 'Pick item(s)'
如果我单击Cancel
或关闭窗口,则$selection
变量为空:
$selection -eq $null
True
否则,如果我确实选择了项目,它们将在类型的对象中返回System.Array
:
$selection
one
these
推荐阅读
- rundeck - RunDeck 的输入选项的最大长度是多少?
- postgresql - 更新和替换包含多个引号 postgresql 的字符串
- owl-carousel-2 - Owlcarousel 2 在窗口调整大小时调整大小(已编辑)
- google-analytics - 让子域在 Google Analytics 中显示为引荐
- javascript - Typescript - 基于字符串比较设置字符串的正确方法
- asp.net-core - 尝试通过 Azure AD B2C 进行身份验证并通过 AAD 中的组进行授权
- c++ - c++ - 在 lambda 中捕获完美转发的变量
- pointers - 调用 func 会返回哪个值
- r - R:Heatmaply 在查看器中创建空白/空白区域
- java - Spring Channel Interceptor - 如何在不引发错误的情况下返回空消息