i'm trying to set focus to the next focusable widget when pressing
ENTER but i can't find any information on the subject.
Am i going blind or is there really no way to do that ?
Nicolas.
One way to do this would be to add a keyboard listener to each of the
widgets you would like focus through. In listener detect the pressing
of the ENTER key and set the focus on the next widget.
You'll need to figure out what the next widget should be. This could
be done by storing a list of widgets.
I'm sure there are more elegant ways of doing this but this would
work.
g
h
On Apr 17, 2:59 am, "nicolas.lecl...@gmail.com"
On Apr 16, 4:59 pm, "nicolas.lecl...@gmail.com"
the first issue is defining "next" I used taborder for that. This
way, the behavior can be the same with the default key (tab) as it is
with your added keys (enter / return).
Then add your focusable widgets to a list in their taborder.
Finally your keyboard listener should also check to see if shift is
pressed! (shift enter should go to the previous widget the same way
that shift tab does)
look up the sender in the list, then set focus on the next or
previous widget in the list.
-jason
On Apr 17, 8:05 pm, Jason Essington <jason.essing...@gmail.com> wrote:
> I just solved this problem in a project That I'm working on ...
>
> the first issue is defining "next" I used taborder for that. This
> way, the behavior can be the same with the default key (tab) as it is
> with your added keys (enter / return).
>
> Then add your focusable widgets to a list in their taborder.
>
> Finally your keyboard listener should also check to see if shift is
> pressed! (shift enter should go to the previous widget the same way
> that shift tab does)
>
> look up the sender in the list, then set focus on the next or
> previous widget in the list.
>
> -jason
>
The second case, I've not found a solution for, but if someone has
one I'd be interested to hear it as well.
-jason
Bit of a shame javascript doesn't have a method for this :/
It may be worth investigating however.
-jason
-jason
Also, an enter won't do anything anyway, unless you have a textarea.
That would require more work.