LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing tab focus with the keyboard

I've read about changing the tab focus from one page to another programmatically; however, I would like to have shortcut keys to change tabs (like many programs that use CTRL+Tab to change windows within the program).
 
I could use an event structure to capture keyboard button presses and then change the value of the tab control, but is there a more straightforward approach?
 
Thanks!
mlloyd
0 Kudos
Message 1 of 5
(3,647 Views)

You can set all other controls not to be tabbed through and the tab control to have its pages tabbed through. That way, when you use tab, only the tab control's pages will be on the tabbing list. This, however, is probably less straightforward.

I'm not sure what's the problem with the method you outlined. In most cases, if you want something to happen, you will have to code it. This appeares to be one of those cases. You can make a subVI to do the tabbing for you, if you don't want to have to code all of it in your VI. Pass the reference of the tab control into the VI after you detect the event and use that to decide whether to increase or decrease the tab value. Be sure to cycle the number back to the first page when it reaches the end.


___________________
Try to take over the world!
Message 2 of 5
(3,632 Views)

I guess there ain't no such thing as a free lunch...  Thanks for the reminder about cycling back to the first tab -- it would be easy to keep incrementing the number and forget to loop back.  I think I'll give it a try!

0 Kudos
Message 3 of 5
(3,626 Views)
You can set a shortcut key (via Advanced >> Key Navigation) for the tab control to give it focus when entered. Once the tab control has focus (via your shortcut key or just via normal tabbing), you can then use the arrow keys to move across tabs.
 
Roy
Message 4 of 5
(3,607 Views)

WOW...  I'm impressed -- it works!  Although I can't use CTRL-TAB, this eliminates the need for using the mouse all the time, which was the ultimate goal.  My VIs are going to become more user-friendly!

Thanks a bunch,
mlloyd
0 Kudos
Message 5 of 5
(3,601 Views)