06-08-2009 10:31 AM
One of the little-known features of string controls is the Update Value while Typing option:
With this option selected, a Value Change event will fire with the Event Structure any time a character is typed (or deleted) in the string control...this is different from the normal behavior of pressing Enter or clicking away from the control to commit its value. Update Value while Typing can be very handy for UIs that require immediate processing of the value being typed. One example I can think of is the password entry field on some websites that assesses the "strength" of your password as you type it. Another simpler example that I've done several times in my UIs is keeping the OK button disabled until a valid value (i.e. non-empty, or unique) is typed in a string.
06-08-2009 03:01 PM
But don't forget the filter event 'key down?', which might be more appropriate for most cases (such as preventing illegal characters in file names).
And also don't forget to inform the user why it is not responding the way he/she thinks of (display status message '/' is illeagal character for file names)
06-11-2009 06:18 AM
I use this feature with an event structure to sort possibilities as each value is typed. Very similar to what the popular search engines are doing. When you start to type in your search criteria, a pull-down list pops up with the most common search list. Then all you have to do is click on the appropriate item to complete the field. It gives the program a nice feel.
06-11-2009 06:48 AM
I think Darren has used this property & the associated style of search for the Quick Drop tool.
Maybe NI should add this property to the Combo Box also.
06-11-2009 09:54 AM
Can you post a simple example of how you did that?
06-11-2009 09:56 AM
I think Partha is simply saying that he would like the combo box to have the same "Update Value while Typing" option that string controls have. I agree that this would be handy...maybe Partha could write an entry in the LabVIEW Idea Exchange for this?
Quick Drop actually uses a Combo Box on its UI (I did this so I could utilize the built-in autocomplete functionality of the combo box). The way I simulate the "Update Value while Typing" functionality with a Combo Box is that I've registered for a Key Down event on the Combo Box, and I update things appropriately when keys are pressed on the Combo Box...effectively implementing my own "Update Value while Typing".
06-11-2009 10:47 AM
Here is a simple version of the way I stumbled to make a version of Quick Drop. It features a top section to paste in your own search possibilities, as you hover over the drop down list, it will highlight the selection, and when you click on a selection it will update the search field and hide the drop down box.
As always, I am open to critiquing
Thanks for trying out my VI
06-11-2009 10:48 AM
I posted a utility which does this here. I can't look at the code at the moment, but I believe in that case I actually used a combination of the Key Down? event and the Value Change event after setting to update while typing, because I needed to handle some additional cases (such as shift, enter and Ctrl+N).
It should be the larger one of the files available there and you will need to dig in the VIs a bit to get to the VI that actually does the searching. The VI itself is more complicated than what you probably need, because it also includes a preference system to provide intelligent sorting.
06-11-2009 11:07 AM
@Branson: nice example. As a possible improvement, I would limit the search string to a single line and highlight the topmost match by default. If the user clicks Enter (will terminate string entry if limited to a single line) select the topmost match.
Thanks for sharing,