LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Associating Particular Keystrokes to a Slider Bar

Hi,
I need to associate keystrokes "1" and "3" to slide my sliderbar left and right. It cannot be any other keystrokes. Also, this should be independent of what else is going on in the program... so the sliderbar shouldn't have to be selected for this to work.
Any clue how i can do this?
Thanks
Aleks. 
0 Kudos
Message 1 of 4
(2,344 Views)
You could use an event structure and filter the key down events for char values 49 and 51 (ASCII codes for 1 and 3). This is demonstrated in the attached vi
Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
        
0 Kudos
Message 2 of 4
(2,340 Views)
Thanks for the VI,
I've implemented it, and it works fine.
The only problem is when I'm running other while loops for timing stuff, the slider bar doesn't respond to every keystroke, and labview slows down a lot. This might be my computer, but do you think there would be another way of implementing it for it not to interfere with timing processes? I'll try adding a 1ms wait in the while loop tomorrow and see if it makes a difference.
Thanks again
Aleks.
0 Kudos
Message 3 of 4
(2,296 Views)
If you are using a single event structure, then you should not have such a problem. A wait instruction in the loop will not change anything : the loop is not running at all, unless you press a key on the keyboard, or click on the stop button. It just waits forever.

Message Edité par chilly charly le 05-11-2006 12:29 PM

Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
        
0 Kudos
Message 4 of 4
(2,290 Views)