Combobobox SelectedIndexChanged does not work correct

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
derhoeppi
Posts: 34
Joined: Sun Apr 06, 2014 11:10 pm

Combobobox SelectedIndexChanged does not work correct

Post by derhoeppi » Fri Jan 04, 2019 5:17 am

I'm using a combox as droptdown element to show the user some possible values. The user is able to write a new value into the combobox. One action of the combobox is to trigger something after the index of the selected combobox has changed. My problem is, that the event is triggered if i change the index with may preassigned value. But if the user type in a new value the event does not be triggered. With a separate button i check the combobox index.
How is it possible to trigger also an event if a new value was inserted?

User avatar
derhoeppi
Posts: 34
Joined: Sun Apr 06, 2014 11:10 pm

Re: Combobobox SelectedIndexChanged does not work correct

Post by derhoeppi » Fri Jan 04, 2019 6:00 am

Okay i find out that i have to use the TextUpdate event. Is it possible to insert a delay for that action, so i have a change to type in more than one character?

User avatar
jvierra
Posts: 13128
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Combobobox SelectedIndexChanged does not work correct

Post by jvierra » Fri Jan 04, 2019 7:08 am

The ComboBox is not designed to do what you are trying to do. You can use the key events to capture each character and take custom actions or just use the CB as designed and use the tab key to accept the input.

Here is one way to do what you are trying to do. (see attachment)
Attachments
Test-CBAppend2.psf
(46.21 KiB) Downloaded 6 times

Locked