Opened 10 years ago

Last modified 4 years ago

#698 new enhancement

GUI - Better support for keyboard input

Reported by: historic_bruno Owned by:
Priority: Nice to Have Milestone: Backlog
Component: Core engine Keywords: gui input keyboard
Cc: Patch:

Description (last modified by elexis)

It would be nice if the engine GUI would handle more standard keyboard input:

  • Pressing enter when a button has focus should cause an onPress event
  • Tab switching of focus between controls (-> #3235) - the ordering could be the same as in the page XML, left to right for children of a given parent object, and/or support a "taborder" property to override the defaults. Obviously not every control should be included in the tabbing, restricting to input controls seems reasonable.
  • Support keyboard accelerators, which are usually specified with an ampersand (&) character in the caption of an input control (the corresponding accelerator is often underlined). This way a dialog that asks "&Yes"/"&No" could be answered with the Y or N keys.
  • Keys could be useful for navigating text lists and dropdowns. Imagine a map list with hundreds of items and you want to skip to "Punjab 1", it should be possible by tapping P to jump to maps named starting with 'p'. That's the simple case; a more complicated extension would be typing multiple characters to match partial words, but that gets messy and is never fully intuitive.

-> Implemented for dropdowns but not ordered lists

Change History (3)

comment:1 by historic_bruno, 10 years ago

  • Pressing enter when a button has focus should cause an onPress event

Might be fixed by implementing ManuallyHandleEvent() for IGUIButtonBehavior, and handling an SDL_KEYDOWN event there for key value SDLK_RETURN. By handling the event in that abstract class we can gain the same behavior in related controls like checkboxes. See IGUIButtonBehavior::HandleMessage() for how mouse press is handled.

comment:2 by historic_bruno, 8 years ago

Description: modified (diff)
Keywords: gui,input,keyboard → gui input keyboard

r12503 is somewhat related to this but not a general solution.

comment:3 by elexis, 4 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.