Assign just "F1" key, without any Modifier, to a MenuItem, it will not fire any event.
Unless handle by code the KeyEvent.
Even setting all the modifiers to "Ignore"(ref. KeyCombination: getName) that will set all the modifier state as "ANY".
At least on my pc, win7 - jdk1.8.0_131 - B4J v5.51, with Italian keyboard layout.
As I read on the net, it is an intetional limitation by javafx team.
So I say, why show "F1" as shortcut, in the menuitem, and then do not fire any event?
Note: I'm not saying that it is a B4J fault.
Maked just fresh app with a MenuBar and a TextArea. (see attachment "Shortcut1.zip")
When the TextArea has the focus, here, isn't work. (in the case TextArea has ever the focus)
A Shortcut should behave system wide or, at least, application wide.
As a workaround I have catched all events in the main stage and then redirect them
to the MenuBar only when is just F1 key interested and none of the modifiers.
This workaround is just a starting point. It work just for F1 key but can be implemented for
anything else. And, of course, it can be done in other several ways. For example it could be done
via java inline...and so on. (see attachment "Shortcut2.zip")
Any idea?
Unless handle by code the KeyEvent.
Even setting all the modifiers to "Ignore"(ref. KeyCombination: getName) that will set all the modifier state as "ANY".
At least on my pc, win7 - jdk1.8.0_131 - B4J v5.51, with Italian keyboard layout.
As I read on the net, it is an intetional limitation by javafx team.
So I say, why show "F1" as shortcut, in the menuitem, and then do not fire any event?
Note: I'm not saying that it is a B4J fault.
Maked just fresh app with a MenuBar and a TextArea. (see attachment "Shortcut1.zip")
When the TextArea has the focus, here, isn't work. (in the case TextArea has ever the focus)
A Shortcut should behave system wide or, at least, application wide.
As a workaround I have catched all events in the main stage and then redirect them
to the MenuBar only when is just F1 key interested and none of the modifiers.
This workaround is just a starting point. It work just for F1 key but can be implemented for
anything else. And, of course, it can be done in other several ways. For example it could be done
via java inline...and so on. (see attachment "Shortcut2.zip")
Any idea?