user1969111
user1969111

Reputation: 1

Change control focus on key press

When I press the Escape key I want to move the focus to the previous control.

How can I achieve this?

Upvotes: 0

Views: 237

Answers (1)

Sander
Sander

Reputation: 402

When you get focus on a control, log the control in a stack so you can always retrieve the previously focussed control.

Next use a keydown eventhandler on the controls and check for the escape key. If escape key is pressed, set focus to the top control in the stack.

Upvotes: 1

Related Questions