LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why doesn't a keydown event work if executed in a subpanel?

If I create a vi that has an event structure and the event structure has a "key down" event, that event case will execute everytime the user activates a key on the keyboard. But if I run the same vi from a subpanel in another vi, the key down event will not occur. Is there a way of configuring the vi's or the subpanel or the event structure so it will pickup on the keyboard activity?


0 Kudos
Message 1 of 6
(4,085 Views)
I'm curious why you would want to go this route -
Wouldn't it make more sense to register the key down event in the main vi and then execute the desired subvi routine (w/o the event structure) from the main vi event?


2006 Ultimate LabVIEW G-eek.

0 Kudos
Message 2 of 6
(4,060 Views)

I have modified the simple.vi provided with labVIEW to create SubPanel.vi. The KeyDown.vi has an event structure which will handle key down events in SubPanel.vi.

I know this is not exactly what you want to achieve. But this may hep you.

Run the SubPanel.vi and press any key on your keyboard.

Hope this helps.

-p_oswal

Download All
Message 3 of 6
(4,056 Views)
Jonnie 5,

The reason for using a structure like this is I need 1 operator using 1 PC w/multiple serial ports, to control muliple test beds. Each test bed is used to calibrate and test an XYZ positioning system. Each test bed uses a different serial port. Multiple iterations of the test program will be running,using unique names and serial ports. The operator will select a test bed by selecting it from the task bar. The calibration portion of the program requires the use of  the keyboard. The operator can be calibrating on one test bed while the others are running an automated test sequence. If I use subvis with popup front panels to monitor and/or control testing and calibration it will become very common for 4, 6, or even 8 front panels to be open at the same time. This scenerio can be confusing to the operators. So only 1 upper level panel per test bed. Each upper level panel has a subpanel to display the current status, test results, and a calibration panel that requires the keyboard.

With that being said, I have discovered that by default the upper level vi has the key focus, so to work correctly I need to add a keyfocus property to any of the controls on the front panel of the vi executing in the subpanel.  When I get this working I'll try 1 upper level vi with a subpanel that will allow the user to switch the panel for each test bed.

I've also just reviewed the solution posted by p_oswal. He's using registered events. I havent tried registered events yet.

Thanks for your help

0 Kudos
Message 4 of 6
(4,031 Views)

I had the same problem... just to clarify it for others looking to solve the same issue.

 

As rad2495 has said above, you just need to add keyfocus to any of the controls on the subpanel VI and the Key Down event will then fire.

 

Thanks for the solution! 🙂

0 Kudos
Message 5 of 6
(3,392 Views)

I would that the OP was able to resolve this already and that they haven't been waiting for 7 years for an answer.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 6
(3,350 Views)