- christopherd
- Posts: 8
- Joined:
Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed
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
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
- Posts: 8
- Joined:
Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed
fyi, I'm using Noesis::Key::Key_Back as the value sent to keydown/keyup event for backspace
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed
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.
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
- Posts: 8
- Joined:
Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed
That's wonderful, thanks ever so much for your help! I'll make those adjustments (where possible)
appreciate your time and help
appreciate your time and help
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed
You're welcome, glad to be helpful.
Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed
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.
Code: Select all
////////////////////////////////////////////////////////////////////////////////////////////////////
/// 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
- Posts: 8
- Joined:
Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed
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:
All events are reaching Noesis, and in the (supposedly) correct order, but the UI will still not allow backspace, arrows, delete etc
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:
Code: Select all
<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)
Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed
Are you activating/deactivating the view correctly?
Code: Select all
/// Activates the view and recovers keyboard focus
virtual void Activate() = 0;
/// Deactivates the view and removes keyboard focus
virtual void Deactivate() = 0;
- christopherd
- Posts: 8
- Joined:
Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed
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
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
Re: Integration to internal engine: Can't use Backspace/Arrows/Delete, all keydown/keyups not processed
Our window implementation is in charge or redirecting display events to view events. The source code is available (Window.cpp):
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.
Code: Select all
// 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);
Who is online
Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 52 guests