Two Level Focus
hjohn at xs4all.nl
Mon Nov 18 09:07:46 PST 2013
On 18/11/2013 14:25, mick.fleming wrote:
>> However, if you do click on it with the mouse (by selecting one of
>> its items), focus is stuck there and cannot be moved anymore with
>> just the 5 buttons.
> when you click on a two_level control with a mouse
> it goes straight into 'internal mode', as at this
> stage it's obvious that there are mouse events.
Yes, I looked at the code, and it is no big deal. I've mapped the OK
button on my remote to ENTER as well.
Unfortunately, I have some problems using the
"-Dcom.sun.javafx.twoLevelFocus=true" mode directly, so I'm simulating
it now by skinning the controls that need it to support two level focus.
ComboBox for example, I just block certain keys (as was done in
TwoLevelFocusComboBehavior) when "isShowing" is true/false. I also
skinned Button and CheckBox to accept ENTER instead of SPACE to
One of the problems encountered is that I cannot focus say a ListView
directly to "interal focus", so whenever I have a window that only shows
a ListView, the user has to press ENTER or OK first to get it to work,
which is a bit counter-intuitive -- so that might be future enhancement
that could be useful.
One thing I was wondering though, it is 5 key navigation, but I actually
use 6 keys (left, right, up, down, select and back). Especially the
back key is very useful for escaping contexts without selecting anything
(like a ComboBox can be escaped without changing the selection). Not
sure if such a key could be supported as well.
Anyway, my app is for personal use only, so I don't mind testing this
kind of thing out and playing around with it -- I'll work around any
problems I encounter, and I don't mind if it stops working or is changed
in the future.
> BTW not all controls were selected to have
> two level functionality, and not all style sheets
> have separate internal-focus styles.
I only use a very limited subset of controls so far (The View controls,
Button, CheckBox and ComboBox). If I encounter problems, I'm getting
familair enough with the Behavior classes and their workings to change
behavior where needed :)
More information about the openjfx-dev