Add callbacks for widgets gaining/losing focus #135
Labels
Core
Add for issues having to do with core functions
Feature Request
Add for a new feature request
Widgets
Add for issues having to do with widgets
Milestone
Is your feature request related to a problem? Please describe.
I am writing a ui with two scroll menus. The user is able to navigate through the widgets using custom shortcuts (e.g. when pressing enter on the left scroll menu, the right scroll menu is selected.)
Because the ui is so simple, there is no need for selecting widgets manually. When a user presses ESC while one widget is focused, I would like to just exit the program. But I see no way to detect the event of one widget losing focus.
Describe the solution you'd like
I would like to be able to register a callback function for a widget losing focus. (For consistency a callback on gaining focus could also be added, but is not needed in my case.)
This would allow me to call the PyCUI.stop() function when a user defocuses one widget.
The feature could also be used to change widget styles depending on the focus.
Possible alternative
An alternative solution would be to allow widgets to catch the ESC-keypress event and replace the default action (going back to widget selection) with a custom action.
The text was updated successfully, but these errors were encountered: