10-21-2022 07:56 AM
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?
10-21-2022 09:35 AM
Just open the properties of any control, go to key navigation and check "skip control when tabbing".
10-21-2022 10:00 AM
@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.
10-21-2022 10:22 AM
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. 😄
10-26-2022 09:45 AM
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 ?
10-26-2022 03:24 PM
@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.
10-27-2022 01:54 AM
You mean returning 1 on a LOST_FOCUS has effects beyond that ? Interesting. I don't recall ever using that event.
10-27-2022 03:31 AM
No, I mean handling which control will have the focus by calling SetActiveCtrl. EVENT_LOST_FOCUS is not swallowable.
10-27-2022 04:10 AM
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.
10-27-2022 07:21 AM
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?