LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Darren's Weekly Nugget 06/08/2009

One of the little-known features of string controls is the Update Value while Typing option:

 

update_value_while_typing.png

 

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.

Message 1 of 19
(6,910 Views)

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)

 

Felix

Message 2 of 19
(6,825 Views)

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.

 

-Branson 

Message 3 of 19
(6,660 Views)

I think Darren has used this property & the associated style of search for the Quick Drop tool. Smiley Happy

 

Maybe NI should add this property to the Combo Box also. Smiley Wink

- Partha ( CLD until Oct 2024 🙂 )
0 Kudos
Message 4 of 19
(6,651 Views)

Hi Parthabe,

 

Can you elaborate on the Combo Box idea?

 

 

0 Kudos
Message 5 of 19
(6,621 Views)

Branson,

 

Can you post a simple example of how you did that?

 

Thanks!


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
0 Kudos
Message 6 of 19
(6,611 Views)

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

Message 7 of 19
(6,610 Views)

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

Branson

Message 8 of 19
(6,584 Views)

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.


___________________
Try to take over the world!
0 Kudos
Message 9 of 19
(6,583 Views)

@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,

Daniel

 

Message 10 of 19
(6,572 Views)