But it seems that this method is not called.
Modification keys. (shift, ctrl, alt) find their way through the MessasgeReceived, but the ESC is swallowed somewhere.
I want to answer my own question.
My use case was: I have a Textfield (BTextControl, a search field) and I want to exit a running search by pressing the esc key.
The problem: The BTextControl won’t get the Esc key not as a message (text changed) nor as a keyDown.
I found a EscapeCancelFilter by DarkWyrm (Who also has written the Haiku guides, I think). With this filter attached to the window I was able to forward the message and catch it elsewhere.
Hmmm, wondering…
Not the same but tangentially related:
Could something similar be made at a more general system level, to use the ESC key to cancel drag-n-drop operations?
As in: you select a group of icons, or some text, start dragging it to other place, change your mind while you still havn’t dropped the thing, and pushing ESC (while the mouse button is still pushed) cancels it.
Or it will be something that needs to be implemented in every place that is a dragging origin?
I ask this from a complete ignorance in the matter, no programming skills, it’s just that was thinking about asking for this in the bugtracker and this piqued my interest.
Thank you for this reference.
It will not be of much use to me directly, as I really have zero coding knowledge and don’t know what to do with this, but I will link to it when creating the ticket for the feature request.
Many thanks!
That post is the only answer coming up in Google when looking for haikuos "BTextControl::KeyDown"
It would be great to add something in the documentation where KeyDown is mentioned, to give a hint that the hook will never be called as this event doesn’t bubble to the parent (BTextControl) from the child (BPrivate::_BTextInput_).
I’m still wondering if it’s a bug or a design shortcoming, but I’m in the process to properly learn the API, so it is hard to assess that.
My use case is that I’m trying to catch every stroke. But I guess I’d have to come up with my own TextControl to do that my way.