tam Posted January 28, 2006 Report Share Posted January 28, 2006 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. Quote Link to comment
Richard_Jennings Posted January 28, 2006 Report Share Posted January 28, 2006 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 Quote Link to comment
nudalakasim Posted January 29, 2006 Report Share Posted January 29, 2006 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 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.