Page 1 of 1

Issue with KeyDown repeat

Posted: 14 Oct 2022, 21:01
by sacchin-theforge
Hi,

How exactly should we be handling repeat events for special keys like backspace and delete? I could not seem to find anything regarding this in the docs. For text input calling Char seems to automatically repeat after a short delay, but for KeyDown calls such as backspace / delete it does not automatically repeat. Should we be calling KeyDown every frame ourselves with a custom delay?

Thanks.

Re: Issue with KeyDown repeat

Posted: 17 Oct 2022, 12:32
by jsantos
Because the first implementation of Noesis was for Windows, the API for input events in views was based on that. If you have doubts about specific details, I recommend debugging our Win32Display with the HelloWorld example, to analyze how events are being sent to the View.

But yes, you need to invoke "KeyDown" and "Char" repeatedly. I checked right now with the BackSpace key.
    /// Notifies that a key was initially pressed or repeatedly pressed
    /// Returns true if event was handled
    virtual bool KeyDown(Key key) = 0;
    
    /// Notifies that a key was translated to the corresponding unicode character.
    /// If a key is repeatedly pressed, its corresponding 'Char' event is sent again.
    /// 'Char' messages are expected to be sent between the corresponding 'Down' and 'Up' events:
    ///  - KeyDown
    ///  - Char
    ///  - KeyUp
    /// Returns true if event was handled
    virtual bool Char(uint32_t ch) = 0;