sacchin-theforge
Topic Author
Posts: 1
Joined: 26 Jul 2022, 00:25

Issue with KeyDown repeat

14 Oct 2022, 21:01

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.
 
User avatar
jsantos
Site Admin
Posts: 3594
Joined: 20 Jan 2012, 17:18
Contact:

Re: Issue with KeyDown repeat

17 Oct 2022, 12:32

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;

Who is online

Users browsing this forum: Ahrefs [Bot], spadapet and 2 guests