VMware Cloud Community
DrBadvibes
Contributor
Contributor

Powershell and PrimalForms ($handler_listBox1_SelectedIndexChanged=)

Hello,

As we are still on VI3 and Storage VMotion is command line based I decided to write a GUI for it. I got everything working but now am working on making the GUI nicer.

For this I'm using Primalforms. Here is myquestion.

To pick my datastore I use a Listbox (Listbox1), everything works fine but I want to use $handler_listBox1_SelectedIndexChanged= to polulate a textbox with aditional information.

I'm not sure what is going on but the handler does not fire. I googled around but cannot find any examples. Has anyone used this handler successfull??

Thanks for your help,

Fred

0 Kudos
1 Reply
DrBadvibes
Contributor
Contributor

Well I finally found the answer.

It looks like you have to define the handler your self. So in your code add to the part where you define the listbox:

$listBox1.Add_SelectedIndexChanged({&$listBox1_SelectedIndexChanged})

Then where you want to call the handler you need to create the function. So add the code:

$listBox1_SelectedIndexChanged=

{

$textBox.text = "clicked on an item in the listbox"

}

If you are interested in the final project, let me know. It will be a few more days to finalize but I'm more then happy to share it.

0 Kudos