Programmatically Open and Close a Dropdown List

The method used and the problem is listed below, thanks for reading and have an awesome weekend!

Main goal: Mimic a modern website dropdown list functionality in vision using ignition 7.9.

Method:
I decided to use a TextField component directly above a Dropdown List Component, where the TextField modifies the SQL “Where Like %{}%” clause in the Dropdown List Data Property Binding.

Problem:
The dropdown list would need to stay open while the TextField is active/has focus, and while the user pans over to the dropdown list to make a selection or move the dropdown slider. When a user makes a selection, we will rely on the default behavior where the list closes on a mouse click. I’m a bit lost on where to start in the prebuilt scripting methods or if I start jumping into the java API and begin trying some java. Swing methods.

Thanks again for reading!

I am not sure I understand why dropdown list would need to stay open? If I understand what you are trying to do it would not need to stay open but rather requery for its resultset based on entered text value.

Try this in the Text Field’s keyPressed event:

event.source.parent.getComponent('Dropdown').showPopup()

The path to the component may be a bit different, but it should give you a place to start.

Thanks for the responses,

@franklepkowski The dropdown menu would need to stay open, so the typed in search results will show the opened dropdown list. We then would allow immediate changes in the Text Feild component to fire changes on the results from the returned query.

@JordanCClark, Thanks! That did the trick! For future reference, how would I lookup showPopup()?

I have a script that exposes the names of components/sub-components then lookup them here? Is there a way to sign up to gain access to comments on the below site?
http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/index.html

showPopup is an inherited method from the underlying Java Swing component, JCombobox - see the ‘methods inherited’ block on the Ignition class, PMIComboBox.