You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A shortcuts look-up table is used to optionally produce a cmd: Command
Given a cmd, try sending to the following targets, stopping after the first to handle the event:
The widget with character input focus, if any [e.g. text input in an EditField]
The widget with selection focus, if cmd.suitable_for_sel_focus() [e.g. text is selected, Ctrl+C is pressed]
The navigation focus, if Alt is not pressed [e.g. a button has focus, Enter is pressed]
The active pop-up parent, if any [e.g. a ComboBox menu is open; Down is pressed]
The navigation fallback [e.g. ScrollRegion uses register_nav_fallback, allowing scrolling via arrow keys when no other widget handles those keys]
If not yet handled and Alt is pressed (or alt_bypass is enabled): look for a matching accelerator key, starting from the deepest open menu
If not yet handled:
Tab navigates to the next (or previous) target
Esc closes the deepest pop-up window, if any
This is reasonably capable, but...
Issue: modifiers
Accelerator keys currently match if other modifier keys such as Ctrl are pressed. Easy to fix (if we have a fixed list of modifier keys).
Issue: custom shortcuts
It should be possible to add applicaiton-defined shortcuts with custom action (not accelerator keys, which are situational and always send Event::Command(Command::Activate)).
The "one registered navigation fallback" strategy is too limited: it doesn't support multiple fallbacks which handle different keys, nor does it help with programmatic calling with undefined target.
Proposed alternative: use a depth-first search of visible children to look for a handler, per key. This is O(n) in the number of visible widgets (not a problem). It could be implemented by EventMgr, but requires some new API to find only "visible children".
The text was updated successfully, but these errors were encountered:
The current model:
EventMgr::start_key_event
cmd: Command
cmd
, try sending to the following targets, stopping after the first to handle the event:EditField
]cmd.suitable_for_sel_focus()
[e.g. text is selected, Ctrl+C is pressed]ComboBox
menu is open; Down is pressed]ScrollRegion
usesregister_nav_fallback
, allowing scrolling via arrow keys when no other widget handles those keys]alt_bypass
is enabled): look for a matching accelerator key, starting from the deepest open menuThis is reasonably capable, but...
Issue: modifiers
Accelerator keys currently match if other modifier keys such as Ctrl are pressed. Easy to fix (if we have a fixed list of modifier keys).
Issue: custom shortcuts
It should be possible to add applicaiton-defined shortcuts with custom action (not accelerator keys, which are situational and always send
Event::Command(Command::Activate)
).These could be used for context menus too. #153
Issue: fallback target
The "one registered navigation fallback" strategy is too limited: it doesn't support multiple fallbacks which handle different keys, nor does it help with programmatic calling with undefined target.
Proposed alternative: use a depth-first search of visible children to look for a handler, per key. This is
O(n)
in the number of visible widgets (not a problem). It could be implemented byEventMgr
, but requires some new API to find only "visible children".The text was updated successfully, but these errors were encountered: