Jump to content

"Key Down?" stalls VI


Recommended Posts

Hi!

I have a LabView VI which has a sub-routine in it. Within this sub-routine, want to use keyboard commands. (The whole sub-routine is within "True" of a True/False case structure, and therefore only executed if I press a button on the front panel and make it "True"). In order to use keyboard commands, I use the "Key Down?" event case within the sub-routine. This works fine when I am within the sub-routine. When I am in main program, though, the VI immediately stalls whenever I press a key on the keyboard (as if it wanted to execute the "Key Down?" event case, but can't. How does it know there is a key down event there, anyway?).

My question: how can I solve this bug? When I delete the "Key Down?" event case from the sub routine, the main program works fine, but that's of course not the solution that I want.

Link to comment
Hi!

I have a LabView VI which has a sub-routine in it. Within this sub-routine, want to use keyboard commands. (The whole sub-routine is within "True" of a True/False case structure, and therefore only executed if I press a button on the front panel and make it "True"). In order to use keyboard commands, I use the "Key Down?" event case within the sub-routine. This works fine when I am within the sub-routine. When I am in main program, though, the VI immediately stalls whenever I press a key on the keyboard (as if it wanted to execute the "Key Down?" event case, but can't. How does it know there is a key down event there, anyway?).

My question: how can I solve this bug? When I delete the "Key Down?" event case from the sub routine, the main program works fine, but that's of course not the solution that I want.

Hi,

Is your event case set to "Lock front panel until event case for this event completes"? Events need to be handled by the event structure as they occurr. It's not a good idea to put an event structue inside a case structure where it might not be able to fire.

It sounds like the event is not handled immediately, causing the front panel to lock until the event is handled and complete.

Richard

Link to comment
Hi!

I have a LabView VI which has a sub-routine in it. Within this sub-routine, want to use keyboard commands. (The whole sub-routine is within "True" of a True/False case structure, and therefore only executed if I press a button on the front panel and make it "True"). In order to use keyboard commands, I use the "Key Down?" event case within the sub-routine. This works fine when I am within the sub-routine. When I am in main program, though, the VI immediately stalls whenever I press a key on the keyboard (as if it wanted to execute the "Key Down?" event case, but can't. How does it know there is a key down event there, anyway?).

My question: how can I solve this bug? When I delete the "Key Down?" event case from the sub routine, the main program works fine, but that's of course not the solution that I want.

If I got you correctly,

You are using a sub routine(Sub VI?) which has an event struct , inside the 'true' case of a main vi and as soon as you run your main VI, the control goes to the true case and the sub VI executes. Here it will wait for a key down event...Now if you look more closely at the event it's source is "THIS VI'. So the event structure will trap events only if the 'Sub routine" is the active window, which means that the program is behaving as it is expected to. So either you can pop up the sub VI or try to trap the event in the main VI itself.

nudalAKasim

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.