I have a text entry field that is passing its contents as a parameter to a named query that displays all the results in a power table for selection. how can I display the results in a popup menu instead of the table, or only have the table visible when the entry field is selected?
What do you mean by “popup menu?” A Drop Down list? If that’s what you mean, then you should be able to put the named query on the data property of the dropdown rather than the table.
This is a bit easier. Components have a property called “focus”. On the Entry Field, set the “focusGained” handler to set the visibility of the dropdown/table to 1. Set the “focusLost” to set the visibility property to 0. My screenshot is setting the visibility property of a label.
Thanks Stuart, the focus gained/lost helped a lot, but it’s still not exactly what I want. As far as the popup menu, I mean like any search bar on the internet practically. You start typing and a drop down menu extends from the text entry showing all the matches to what you have typed so far, then you can choose the one you want by clicking on it and then the drop down disappears filling the text entry box with what you clicked on. The dropdown menu in ignition, from what I’ve tried, you have to click on it for it open and show the results to then choose from. Thoughts?
I see. I too have wanted something like that.
Personally, I’ve used something like this example. It’s written in Ignition 7.9.7 but unless you’re already using it, don’t update! There are some bugs that make developing a huge pain. You can edit the file in a text editor and change the version number at the top.
You will have to modify the SQL to use your tables and columns.
It’s a bit crude, but when you start typing, the table will populate. The table will stay visiable until you double click on one of the table rows. When you double click a row, that value will be placed into the input box.
Example.proj (7.9 KB)
Try the dropdown with lenient mode and editable turned on. You’ll have to script what to do when there’s no match at all.
I don’t see where you can turn on editable? It shows that it can be strict, lenient, or editable, but only one or the other only.
I’ve got it working pretty well with another option that seems to be pretty close to what I wanted. I have a hidden power table that shows the search results using the text entry as a parameter in a named query using
where 'field' like concat(:text, '%') I have the table being set as visible on keyPress in the text entry box causing the table to be visible when you start typing. Then on the table, when mousePressed on a search result, it sets the text entry box to that value and sets the table visibility back to zero. I’m going to have a button that logs all the information in all the text entries etc, then set all the text entries back to empty for the next cycle. Thanks
You’re right. Lenient is a subcase of editable.