LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

skip controls on TAB

Hi,

 

I have a panel with a few buttons and some text input fields.

 

When I press the TAB key I want to activate only 3 buttons and not the other buttons or text input fields.

 

Is there a way to remove the tab order of a control and keeping it as an control and not an indicator?

0 Kudos
Message 1 of 10
(1,285 Views)

Just open the properties of any control, go to key navigation and check "skip control when tabbing".

 

 

altenbach_0-1666362917392.png

 

0 Kudos
Message 2 of 10
(1,262 Views)

@altenbach  ha scritto:

Just open the properties of any control, go to key navigation and check "skip control when tabbing".


That's a good option but unfortunately applies only to LabVIEW controls: since we are on the CVI board, unless there is something not obvious to me that points to LV, this item must be addressed at code level.

 

To skip some control while tabbing you must set a control callback in which to trap EVENT_KEYPRESS; decode the virtual key calling GetKeyPressEventVirtualKey  () and handle VAL_TAB_VKEY key setting the active control on the one you want to.

 

An alternative is to recursively get ATTR_NEXT_CTRL while tabbing skipping unwanted controls until a valid one is found.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 10
(1,255 Views)

Ah, sorry about that. I found your post in the general "Unsolved topics" collection and did not notice that it was not LabVIEW. Now that I had my first morning coffee, things are a bit clearer. 😄

0 Kudos
Message 4 of 10
(1,235 Views)

Maybe you can answer to EVENT_GOT_FOCUS on all unwanted controls and do a SetActiveCtrl to the 1st button ? But then how do you input data in them ?

0 Kudos
Message 5 of 10
(1,193 Views)

@gdargaud  ha scritto:

... But then how do you input data in them ?

That's why I suggested to trap key presses to handle the TAB key. 😉

Even trapping the lost focus event is not a good idea since the effect would be to move the focus away from the control you clicked on.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 10
(1,180 Views)

You mean returning 1 on a LOST_FOCUS has effects beyond that ? Interesting. I don't recall ever using that event.

0 Kudos
Message 7 of 10
(1,164 Views)

No, I mean handling which control will have the focus by calling SetActiveCtrl. EVENT_LOST_FOCUS is not swallowable.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 8 of 10
(1,152 Views)

Makes sense. My guess would be that such a user interface would be annoying to use. I'd probably go a slightly different way with a [Lock] button to turn the numerics to indicators when not in use, leaving only the buttons accessible via the [Tab] key.

0 Kudos
Message 9 of 10
(1,147 Views)

It could be a feasible solution, if it fits customer expectations.

But you know what? We are missing some feedback from the original poster! Both of us can implement a solution according to personal feelings, but... will it satisfy the end user?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 10 of 10
(1,134 Views)