Jump to content

Keystrokes not recognized in event case


Recommended Posts

I've been messing with this all morning and it just doesn't make sense. After I enter an event case, keystrokes are not being recorded in a string control. I thought at first it was because "Update value while typing" wasn't checked but that didn't help. Please see the attached VI.

Here's what's supposed to happen. The keystrokes will eventually come from an RFID device, but for now typing from the keyboard does the same thing. When the VI is entered it sets the key focus to the "RFID ch" control. Then it waits for a "[", then clears the control and waits for text followed by "]". After that the "Key down" event for that control is released and a "Key down" event for "RFID pump" is registered and key focus is set for that control. Then basically the same thing happens for the newly registered control except it waits for "<text>". For some reason after the "<" is recognized it stops getting data from the control. Any ideas why? I've tried creating a new control instead of RFID pump, but it does the same thing. The stuff that happens in the second event is exactly the same as the first. I can't see why it won't work.

George

Download File:post-2786-1218125368.vi

Link to comment

I think you need to right-click on the second "Key Down" registration in the "Register for Events" node inside the "<RFID ch>: Key Down" event and uncheck "Lock Panel Until Handler Completes". You should probably do the same for the node outside the loop as well, just for consistency.

Jaegen

Link to comment

QUOTE (george seifert @ Aug 7 2008, 12:10 PM)

Here's what's supposed to happen. The keystrokes will eventually come from an RFID device, but for now typing from the keyboard does the same thing. When the VI is entered it sets the key focus to the "RFID ch" control. Then it waits for a "[", then clears the control and waits for text followed by "]". After that the "Key down" event for that control is released and a "Key down" event for "RFID pump" is registered and key focus is set for that control. Then basically the same thing happens for the newly registered control except it waits for "<text>". For some reason after the "<" is recognized it stops getting data from the control. Any ideas why? I've tried creating a new control instead of RFID pump, but it does the same thing. The stuff that happens in the second event is exactly the same as the first. I can't see why it won't work.

I've only taken a quick cursory look at your VI, but a better approach would probably be to remove the while loops from inside your event cases, and instead use a shift register in the outer loop to build up your string each time a key down event occurs, until you reach the termination character.

Link to comment

QUOTE (jaegen @ Aug 7 2008, 11:53 AM)

Ah that's it! I didn't know that option was there. I was looking for that option under the actual event, but it wasn't there.

George

QUOTE (ned @ Aug 7 2008, 12:51 PM)

I've only taken a quick cursory look at your VI, but a better approach would probably be to remove the while loops from inside your event cases, and instead use a shift register in the outer loop to build up your string each time a key down event occurs, until you reach the termination character.

I think you're right about that. I was doing a quick and dirty to check out the dynamic event handling.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.