Do you want me to file a Jira issue for this? Regards,
On Mon, Oct 7, 2013 at 6:03 PM, Artem Ananiev <[email protected]>wrote: > > On 10/7/2013 6:53 PM, Richard Bair wrote: > >> That being said, this seems like a very common use case, and I wonder if >> there is something more we could do (in the longer term, short term do as >> Artem suggests) >> > > One of the options is to provide API to query for keyboard state at any > arbitrary moment, whether particular key is pressed or not. Even if we only > support locking keys (Caps, Num, Scroll, Kana) and control keys (Shift, > Control, Command, Alt), it will be of great value. Game developers will be > happy to have such API for all the keys, including navigation and letter > ones. > > Thanks, > > Artem > > > On Oct 7, 2013, at 3:56 AM, Artem Ananiev <[email protected]> >>> wrote: >>> >>> >>> On 10/7/2013 2:40 AM, Pedro Duque Vieira wrote: >>>> Hi, >>>> >>>> I have the following use case: >>>> When the user presses shift and the mouse is hover the chart component >>>> the >>>> cursor must change to an open hand cursor signaling to the user that the >>>> chart is ready for a panning action. >>>> The problem is that for this to be possible I want the chart to be able >>>> to >>>> listen to keyboard events even when it doesn't have focus. >>>> >>>> I think this is not possible and I wonder why. Swing was the same, you >>>> could only listen to keyboard events if the control had focus. Is this a >>>> technical limitation? If there is no technical limitation I think it >>>> would >>>> be better to remove this restriction, I think it is limiting and the >>>> above >>>> scenario is a good use case to show that. >>>> >>> >>> This is not a technical limitation, it's just the way how it's supposed >>> to work. All the key events are dispatched to the component in focus, this >>> is what input focus is. >>> >>> Scenario you described should be easier to implement in FX than in >>> Swing. In AWT/Swing, input events are dispatched to a single component, >>> while FX is much more flexible. All the events are delivered to a Scene >>> first, then dispatched to the focused component (or component under mouse, >>> for mouse events), then bubbled up back to the Scene. What you need is to >>> register a custom event filter for the scene and listen to all the key >>> events. >>> >>> See Scene.addEventFilter() and Scene.addEventHandler() for details. >>> >>> Thanks, >>> >>> Artem >>> >>> Thanks, best regards, >>>> >>>> -- Pedro Duque Vieira
