KeyPreview

Dec 13, 2010 at 8:48 AM

Hello,

in my MainView (Form) i set KeyPreview to true.

In the first Control i show, the OnKey Events are thrown, but if i change the control it does'nt work anymore. Why that?

 

Kind regards

svbirdy

Coordinator
Dec 13, 2010 at 3:32 PM

Can you attach a *simple* solution that reproduces this?  If so, I'll look into it.

Dec 14, 2010 at 7:45 AM

 

For example if you override the OnKeyPress method in ViewA in the FormStack example, start the application and press a letter. Then change to ViewB and back to A.
Now the letter input is not recognized.

In the meantime I used the solution that i subscribe to the MainView KeyPress in OnActivated, and unsubscribe in deactivated like that:

RootWorkItem.Items.Get<MainView>(ViewNames.MainView).KeyPress += OnKeyPress;

Would be fine if you find the reason, why ovverriding the OnKeyPress doesn't work...

Kind regards svbirdy

Sep 17, 2012 at 3:04 PM

I had the same issue.  

It can be reproduced by adding key events to the controls in any of the sample projects, where this issue occurs also.

Coordinator
Sep 21, 2012 at 6:00 PM

The latest change set (just checked in) fixes the issue.  It was due to the SmartPart not getting Focused when it was activated.