Live Search Control
Thu, 03/09/2023 - 02:16 pm
Implements a live search control for user panels/windows, in which the search results are displayed in a modern-looking drop down menu that gets updated with every keystroke. The effect is that the user gets a live menu update as they type.
A selection can be made with the mouse or by navigating the menu with the keyboard and pressing enter/return. Mouse scroll events are handled as well if the menu is large enough to require it. Users set a trigger function that is activated upon selection of an item.
There's an example implementation that can be run using: Search#ExampleLiveSearch()
The type of search carried out is determined by the mode:
mode = 0 // Searches a text wave for the search input
mode = 1 // Searches the search folder for any wave that match the search input
mode = 2 // Searches the search folder for 2D/3D waves that match the search input
mode = 3 // Searches for user function that match the search input
My use case has been for selecting a user function from a large-ish library of functions, that is otherwise clunky to navigate through using traditional menus and submenus.
See the comment header in the .ipf for more clarification on usage and how to set/change the control's parameters after it's already been initialized.
Works nicely on Igor 8 for mac, *should* be fine for Windows but haven't tested yet.
Edit: This was not added by Ben but by Johan. Strangely I am far from a hacker but accidentally found this bug...
Igor Pro 9
Igor XOP Toolkit
Igor NIDAQ Tools MX
You should add some /Z flags for
Wave/T/Z searchWave = $""
and you're missing a line to create a global variable:
String/G DF:SearchGroup = ""
March 10, 2023 at 04:26 am - Permalink
Ah thanks Tony. The offending SVAR was meant to be SearchGroupBoxControl (not SearchGroup). Updated the ipf.
March 10, 2023 at 09:29 am - Permalink
Ben. I think that I found a bug in the forum web page. Would it be OK if I "hacked" your original post to show the bug so that it can be fixed?
Sadly this is the only way I know how to show the bug...
March 10, 2023 at 10:06 pm - Permalink
And when I'm at it I'd like to say how nice I think this project is - it's not mine but would suit your project well https://www.wavemetrics.com/project/Updater
March 11, 2023 at 12:19 am - Permalink
In reply to Ben. I think that I found a… by Johan.Soderstrom
Hi Johan, yep that's fine, hack away!
March 11, 2023 at 11:04 am - Permalink