From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Skip control when tabbing decided programmatically

Hi,

 

I'm hoping I can get some help on this problem.  I am trying to skip a control based on the value of the previously entered control.  Here's a synopsis of what I'm trying to do:

 

-My front panel has 6 controls (Lot ID 1,2,3 and Quantity 1,2,3).

-The tabbing order for the controls is set to Lot ID 1, Quantity 1, Lot ID 2, Quantity 2, Lot ID 3, Quantity 3.

-If the user enters a non-zero or non-empty string value into the Lot ID and presses tab, the following Quantity control defaults to 25 and this value is highlighted.

-When they tab off the Quantity control, the next Lot ID is selected and the value is highlighted.

-If the user enters a zero or empty string value into the Lot ID and presses tab, I want to change the Quantity control to an empty string and then move on and automatically select the next Lot ID and highlight it's value.  

 

I've attached my sample code.  Everything works as it should except the last step.  I can't get it to skip the Quantity control when a zero/empty string is entered in the Lot ID.  Any ideas?  

 

Thanks!

0 Kudos
Message 1 of 3
(2,615 Views)

Your code seems to work okay for me.

 

The only time it seems like it doesn't work is if there was something in the ID string that would have allowed the qty to be tabbed to, then you enter the 0 or space.  Tabbing will take it to qty.  But tabbing out of it at later attempts will skip over qty.  It's like there is a bit of race condition where the tabbing into the control is already queued up to happen before the update to disable the tabbing to the qty control has taken effect.

 

Instead of relying on the tab order, perhaps you should disable tabbing on all the controls and rely on the Key down event to determine whether or not to tab and use focus to programmatically "tab" to the next control.

Message 2 of 3
(2,568 Views)

Thanks for the reply.  I ended up disabling the Qty fields durring tabbing and leaving the Lot ID fields enabled for tabbing.  I rewrote the code a bit and now I use the key focus property node to refocus on the appropriate field depending on what was entered into the Lot ID field.  Thanks again for the help!

0 Kudos
Message 3 of 3
(2,523 Views)