FormItems: add conversion from any list

This commit is contained in:
Wroclaw 2022-11-12 01:05:51 +01:00
parent 56a27f6b9f
commit 816ef0abe0

View file

@ -65,6 +65,22 @@ class FormItems : System.Collections.ArrayList<#FormItem#> {
}
return $rvalue
}
FormItems() {}
FormItems([System.Collections.IEnumerable] $list) {
<#
.Description
Creates FormItems list with all items in list
where values are those items
and displaytext as string representation of them
TLDR it converts any list to FormItems
#>
foreach ($i in $list) {
[void] $this.Add([FormItem]::new($i, $i.ToString()))
}
}
}
function renderForm([FormItems]$items, [String]$label, [String]$title, [System.Windows.Forms.SelectionMode]$mode) {