[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

Re: [XaraXtreme-dev] Keypress handling



Phil Martin wrote:

Luke Hart wrote:

All,

It seems that having the key press handler in a window has 2 problems:

* If the window isn't present no key press handling is done (obviously). This happens when handling is in the Render Window and no documents are open. The problems we saw when I put the key handling in the view class are just a special case of this.


Can you actually get away with having just one keypress handler? wxWidgets should be offering the keypress event to windows in some logical order, one of which should be the application frame window, shouldn't it? In which case you'd need handlers in various windows...???

Whoops, I put the last sentence in the wrong point! It should have read:

* If the window isn't present no key press handling is done (obviously). This happens when handling is in the Render Window and no documents are open. * If the window isn't the one that is actually receiving the key press, the key down is lost (it's sent for IM handling and never gets any further). This means that we can't handle key presses in the main frame. The problems we saw when I put the key handling in the view class are just a special case of this.

I was never suggesting that we need handlers in multiple windows (with the inherent problems with selecting the best one). If you read the 2nd point, I am saying that if we try and handle the events in an ancestor of the window with focus, the key down event is not received. This what was causing all the problems Charles reported over the week-end.


There are 2 possible ways that this could be addressed:

1) Move back to handling the keys at the application level. This is how they were working before the changes to satisfy the focus handling rules and had been proved to work.


Would the visual feedback of focus ownership work properly then?

Yes, the focus control is totally separate to the key handling code.

   Luke