Showing results for 
Search instead for 
Did you mean: 

Key Focus lost?

Problem: I am working on a large application that uses several subpanels to create a clean looking GUI. One of the subpanels is used for several different features, one of which is to bring up a VI that allows the user to enter requested data. The problem is that the subpanel where the data needs to be entered (or more specifically the string control) quickly loses the Key Focus after it is selected. I have looked over the code using several different searches trying to find any Key Focus property nodes that may be repeatedly taking the Key Focus, but have been unsuccessful to this point.

Question: Is there any way to monitor the Key Focus of an entire application?

Extra Info: (not sure what may be helpful here)
LabVIEW 8.20
Producer/Consumer Event Design Pattern (using several queue & consumer loop combinations)
XControls are also used

Thanks for any help/ suggestions you can give me!
0 Kudos
Message 1 of 5

There is no built in tool in LabVIEW to tell you what has key focus, but why not write your own with VI server? Here's a quick example of the program I wrote that opens the front panel in question and then monitors all of the controls to determine the label of the control with key focus.

Message 2 of 5
Thanks for your reply Xaq. Sorry it's taken me so long to reply, but this issue sort of got pushed to the bottom of the pile. I finally found the solution to the problem and though I would post it in case anybody else runs into a similar issue. I implemented your idea and extended it so far as to look inside of arrays and clusters as well. Unfortunately, this did not reveal the root of the problem.

It turns out that the problem was not with the application at all, but rather an OS issue. I was updating XControls in a VI running continuously in a subpanel.  Because the variables in the XControls could be changed by the user I was constantly updating its properties, one of which was the tip strip text. Once I removed this property update the program worked just fine. I'm guessing that the OS generates some sort of interrupt that causes the program to briefly lose focus.

Moral of the story: Updating the Tip Strip property of a control will cause the key focus to be lost. I have only tested this for XControls, but I'm assuming it is the same for regular controls as well.

Hopefully this will provide some help to others later. Believe me it was no fun to troubleshoot.

Thanks again Xaq.
0 Kudos
Message 3 of 5

I ran into this same issue.  Here are some vis that illustrate the point.  It took me forever to figure out that the Tip Strip property was causing this problem!


Run Subpanel_outside and try to enter "12" in the numeric control.  It will get the 1, then lose focus. 


If you edit the block diagram for Subpanel_inside, switch the Diagram Disable structure to the other case which has no tip strip property and run it again. This time, it will not lose focus.

Download All
Message 4 of 5
Confirmed bug: CAR #148398
0 Kudos
Message 5 of 5