Multi-Select List Box in Primal Forms


I am still working my way through the learning process in PrimalForms, (excuse me Powershell Studio 2012). I was trying to create a multiselection list box without much success. I posted a plea for help on Sapien’s Scripting Answers board and got pointed to some articles on technet.


Here is the ListBox Control: ListBox Control

Here is the SelectionMode Property: SelectionMode Property

You can retrieve the selected items by enumerating the, what else,
‘SelectedItems property: SelectedItems property

When you build your form, grab the ListBox control from the left hand side of the page and place it on your new form. Size to your delight. Then on the far right side, Under BEHAVIOR, find SelectionMode and then select MultiSimple. This alows you to highlight more than one item in your ListBox. The first list box is named ListBox1 by default. Here is the code I used to process the items selected.


###### Start Posh Script ########

$status = $curItems = @()
	$curItems = $listBox1.SelectedItems
	foreach ($thing in $curItems) {
		$status += $thing
		$statusbar1.Text = "Curent Item = $thing"
		Command($thing)
		}
$richtextbox1.Text = "You selected these items $status"

############# End POSH Script ###############