Live Search Control

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... 

LiveSearchControl.ipf (23.6 KB)

Looks nice.

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 = ""

 

Ah thanks Tony. The offending SVAR was meant to be SearchGroupBoxControl (not SearchGroup). Updated the ipf. 

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... 

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More