How to catch Tab key in PRIM_LIST.DropDown (VLF-ONE)

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
vegeta
Posts: 4
Joined: Mon Oct 24, 2016 4:15 pm

How to catch Tab key in PRIM_LIST.DropDown (VLF-ONE)

Post by vegeta »

Hello everyone,

Good day. Newbie here and hoping to get some help. I'm trying to add a feature within a VLF-ONE Reusable Part where a DropDown (PRIM_LIST.DropDown) would be able to signal an event when the Tab key is pressed. The goal is to be able to set the focus on another component (not the next component by Tab Order) when the user hits the said key. However, PRIM_LIST.DropDown does not have a KeyPress event that I could use to catch the Tab key. The List Column (PRIM_LIST.String/Number) does have a KeyPress event but for some reason I am unable to trigger it.

Any ideas? Thanks.
dannyoorburg
Posts: 177
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

Re: How to catch Tab key in PRIM_LIST.DropDown (VLF-ONE)

Post by dannyoorburg »

Hi,

So why can't you just set the correct Tab Order?

Regards,
Danny
User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: How to catch Tab key in PRIM_LIST.DropDown (VLF-ONE)

Post by Stewart Marshall »

What you're effectively saying is that two different controls will be able to "tab" to the same control i.e. The drop down or the control that is actually the one immediately before your target control.

From a UI design POV this is typically considered to be something best avoided, particularly because Shift+Tab won't take you back to where you came from half the time.

If you really want to do it though, you can turn TabStop off for the controls that are in the way when the DD gets focus, and then turn it back on when it loses focus.
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au
vegeta
Posts: 4
Joined: Mon Oct 24, 2016 4:15 pm

Re: How to catch Tab key in PRIM_LIST.DropDown (VLF-ONE)

Post by vegeta »

dannyoorburg wrote: So why can't you just set the correct Tab Order?
It will be used in a generic, ancestor-type component and the target object (i.e., the "next" component after hitting Tab) could be anything that can receive focus.
Stewart Marshall wrote:What you're effectively saying is that two different controls will be able to "tab" to the same control i.e. The drop down or the control that is actually the one immediately before your target control.
The target object is variable, only known at run time, and is dependent on previous input. So yes, that's one way of putting it. This is also the requirement as I understand it.
Stewart Marshall wrote: From a UI design POV this is typically considered to be something best avoided, particularly because Shift+Tab won't take you back to where you came from half the time.

If you really want to do it though, you can turn TabStop off for the controls that are in the way when the DD gets focus, and then turn it back on when it loses focus.
Hmmm this is different than the feature being requested but could be a possible solution. I'll look into it.

Thanks for your responses; I appreciate it. If anyone else have an idea I'm all ears.
User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: How to catch Tab key in PRIM_LIST.DropDown (VLF-ONE)

Post by Stewart Marshall »

There is no way of stopping the Tab key working the way Tab is intended to work, other than by manipulating the TabStop and TabPosition properties of other components.

But what I still don't understand is this. If it's so important that tabbing away from the dropdown goes to a specific control, why isn't that control the next in the tab sequence?
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au
vegeta
Posts: 4
Joined: Mon Oct 24, 2016 4:15 pm

Re: How to catch Tab key in PRIM_LIST.DropDown (VLF-ONE)

Post by vegeta »

Stewart Marshall wrote:There is no way of stopping the Tab key working the way Tab is intended to work, other than by manipulating the TabStop and TabPosition properties of other components.
This is what I've done on a similar component containing an input field: The component waits for the Tab key on the field's KeyPress event and Signals out an Event when the key is pressed. The container application is waiting for this Event to occur and performs the actions as necessary.
Stewart Marshall wrote:But what I still don't understand is this. If it's so important that tabbing away from the dropdown goes to a specific control, why isn't that control the next in the tab sequence?
As I mentioned earlier, the 'next' control is not specific - it could be any control that has a SetFocus method. Tabbing away is important because I'm using it as a signal to perform application-specific calculations.
User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: How to catch Tab key in PRIM_LIST.DropDown (VLF-ONE)

Post by Stewart Marshall »

vegeta wrote:Tabbing away is important because I'm using it as a signal to perform application-specific calculations.
If the user uses the tab key to leave the field you perform some calculations. What if they just click somewhere else?

For the behaviour you're describing, LostFocus or perhaps the the Changed event would be a far more appropriate trigger, depending on the nature of the work being done.


EPC 141010 will introduce the KeyPress event for DropDown. This will be available very soon.
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au
vegeta
Posts: 4
Joined: Mon Oct 24, 2016 4:15 pm

Re: How to catch Tab key in PRIM_LIST.DropDown (VLF-ONE)

Post by vegeta »

Stewart Marshall wrote: If the user uses the tab key to leave the field you perform some calculations. What if they just click somewhere else?
I have a button that does the said calculation. The goal is to perform the same calculation when you press Tab as well.
Stewart Marshall wrote: For the behaviour you're describing, LostFocus or perhaps the the Changed event would be a far more appropriate trigger, depending on the nature of the work being done.
It's very easy to lose Focus on a component or trigger the Changed event. The calculation takes quite some time so it's not something that is ideal to trigger unnecessarily (stated differently, the user must have the intention of hitting Tab with the same intention of hitting the calculate button).
Stewart Marshall wrote: EPC 141010 will introduce the KeyPress event for DropDown. This will be available very soon.
That's great. :-)
User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: How to catch Tab key in PRIM_LIST.DropDown (VLF-ONE)

Post by Stewart Marshall »

I can safely say, I've never heard of a UI where tabbing out of a field is the equivalent of a button click.

I've seen a function key on the VERY odd occasion, but the norm is to use Enter.
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au
Post Reply