christopherd
Topic Author
Posts: 8
Joined: 09 May 2022, 09:05

Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed

14 Jun 2022, 12:38

fyi: v3.14, Windows C++

Hi,
I'm integrating v3.14 into our engine, and I'm attempting to tie together our input systems with Noesis.
We capture key down/up events and are sending them to Noesis, and we always receive a false (for not processed) from these functions (view->keyup / view->keydown).
The char function also returns false, but the login does display characters pressed, but we cannot use del, backspace, etc, so we can't undo characters in the textbox.

our system events are being given in the following order: keydown, keyup, char

I'd really appreciate some insight into where I should be looking, or where I'm going wrong if you can, please?

Cheers
 
christopherd
Topic Author
Posts: 8
Joined: 09 May 2022, 09:05

Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed

14 Jun 2022, 14:16

fyi, I'm using Noesis::Key::Key_Back as the value sent to keydown/keyup event for backspace
 
User avatar
sfernandez
Site Admin
Posts: 2569
Joined: 22 Dec 2011, 19:20

Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed

15 Jun 2022, 11:11

Hi,

Keyboard events should be injected in the view in the following order: KeyDown, Char, KeyUp. This is the order that Win32 is sending those messages (you can check it in our samples and the Win32Display implementation).

A TextBox only handles the KeyDown event for a few keys: Delete, Backspace (Key_Back is correct), arrow keys, Home, End, Return (when AccepstReturn is true), Tab (when AcceptsTab is true), and Space. The rest of keys are translated to the corresponding unicode point and handled within the Char (TextInput) event.
 
christopherd
Topic Author
Posts: 8
Joined: 09 May 2022, 09:05

Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed

15 Jun 2022, 11:13

That's wonderful, thanks ever so much for your help! I'll make those adjustments (where possible)

appreciate your time and help
 
User avatar
sfernandez
Site Admin
Posts: 2569
Joined: 22 Dec 2011, 19:20

Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed

15 Jun 2022, 11:14

You're welcome, glad to be helpful.
 
User avatar
jsantos
Site Admin
Posts: 3456
Joined: 20 Jan 2012, 17:18
Contact:

Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed

15 Jun 2022, 17:19

I have improved the documentation to better reflect this. But as Sergio said, it is much better to put break-points in any of our examples. Display implementations include source code.
////////////////////////////////////////////////////////////////////////////////////////////////////
/// Views manage UI trees
////////////////////////////////////////////////////////////////////////////////////////////////////
NS_INTERFACE IView: public Interface
{
    /// 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 released.
    /// Returns true if event was handled
    virtual bool KeyUp(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;
 
christopherd
Topic Author
Posts: 8
Joined: 09 May 2022, 09:05

Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed

17 Jun 2022, 16:26

Hi

Sadly, the correct ordering of the messages has not helped in the login example, the backspace (and other keys) are sent to the view, but somehow not processed

This is some debug output from the engine, showing the backspace key being pressed - the keydown/char/keyup events in the order they are sent to Noesis:
<16:20:19> ** NOESIS: wm_keydown event (WPARAM=8 Noesis::Key=2)
<16:20:19> ** NOESIS: wm_char event (char=8)
<16:20:20> ** NOESIS: wm_keyup event (WPARAM=8, Noesis::Key=2)
All events are reaching Noesis, and in the (supposedly) correct order, but the UI will still not allow backspace, arrows, delete etc
 
User avatar
jsantos
Site Admin
Posts: 3456
Joined: 20 Jan 2012, 17:18
Contact:

Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed

17 Jun 2022, 23:16

Are you activating/deactivating the view correctly?
/// Activates the view and recovers keyboard focus
virtual void Activate() = 0;
/// Deactivates the view and removes keyboard focus
virtual void Deactivate() = 0;
 
christopherd
Topic Author
Posts: 8
Joined: 09 May 2022, 09:05

Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed

21 Jun 2022, 12:56

Sorry for the late reply.

Yes, the view is created and valid. It is activated, and is receiving all other events. It displays characters pressed for the "login" sample, but no bkspc, del, etc.
I also checked the view update, it is being given global seconds, not delta time
 
User avatar
jsantos
Site Admin
Posts: 3456
Joined: 20 Jan 2012, 17:18
Contact:

Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed

22 Jun 2022, 12:08

Our window implementation is in charge or redirecting display events to view events. The source code is available (Window.cpp):
// Hook to display events
mDisplay->LocationChanged() += MakeDelegate(this, &Window::OnDisplayLocationChanged);
mDisplay->SizeChanged() += MakeDelegate(this, &Window::OnDisplaySizeChanged);
mDisplay->ScaleChanged() += MakeDelegate(this, &Window::OnDisplayScaleChanged);
mDisplay->FileDropped() += MakeDelegate(this, &Window::OnDisplayFileDropped);
mDisplay->Activated() += MakeDelegate(this, &Window::OnDisplayActivated);
mDisplay->Deactivated() += MakeDelegate(this, &Window::OnDisplayDeactivated);
mDisplay->MouseMove() += MakeDelegate(this, &Window::OnDisplayMouseMove);
mDisplay->MouseButtonDown() += MakeDelegate(this, &Window::OnDisplayMouseButtonDown);
mDisplay->MouseButtonUp() += MakeDelegate(this, &Window::OnDisplayMouseButtonUp);
mDisplay->MouseDoubleClick() += MakeDelegate(this, &Window::OnDisplayMouseDoubleClick);
mDisplay->MouseWheel() += MakeDelegate(this, &Window::OnDisplayMouseWheel);
mDisplay->MouseHWheel() += MakeDelegate(this, &Window::OnDisplayMouseHWheel);
mDisplay->Scroll() += MakeDelegate(this, &Window::OnDisplayScroll);
mDisplay->HScroll() += MakeDelegate(this, &Window::OnDisplayHScroll);
mDisplay->TouchDown() += MakeDelegate(this, &Window::OnDisplayTouchDown);
mDisplay->TouchMove() += MakeDelegate(this, &Window::OnDisplayTouchMove);
mDisplay->TouchUp() += MakeDelegate(this, &Window::OnDisplayTouchUp);
mDisplay->KeyDown() += MakeDelegate(this, &Window::OnDisplayKeyDown);
mDisplay->KeyUp() += MakeDelegate(this, &Window::OnDisplayKeyUp);
mDisplay->Char() += MakeDelegate(this, &Window::OnDisplayChar);
Could you put breakpoints in every event and run the Login sample from our SDK vs your implementation to see what's the difference? It seems there is something we don't have properly documented about ordering of input events.

Who is online

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