Project

General

Profile

Create Wt::WKeyEvent instance?

Added by lm at almost 5 years ago

I have a centralized key press handler that takes Wt::WKeyEvent. It is connected to Wt::WApplication::globalKeyPressed so it takes a Wt::WKeyEvent. Unfortunately, this handler isn't called when escape is pressed. I'm creating a handler on Wt::WApplication::globalEscapePressed to call my key pressed handler and would like to pass a Wt::WKeyEvent with ::key == Wt::Key::Escape, but it looks like I am unable to set the key property either by constructor or by a property setter. Am I missing anything? Why would this be the case? (I'm speaking of the documented interface; I do see the undocumented JavaScriptEvent constructor.)

Why make objects immutable? Especially if they're being passed by copy!? They should be generally mutable, but passed by const &. I know there are always tons of factors that go into these decisions, and I'm sure I don't appreciate hardly any of the concerns, but on the surface, this seems to be a design mistake?