You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are creating a node editor, where nodes can contain controls inside of them.
To handle deleting of nodes, we use the shortcut on the window in which we draw the node editor.
if(ImGui::Shortcut(ImGuiKey_Delete, ImGuiInputFlags_RouteFocused)) {
// handle deleting the selected nodes and connections
...
}
However, we noticed that when we have an active text edit (via InputText for example), selecting text and pressing the delete keyboard button, would not only delete the text, but still trigger the deletion shortcut on the window, even though it is not focused (the focus is in the text edit).
After some debugging, we found that the InputText widget doesn't set key ownership on the delete key when it is active.
This is fixed by adding ImGuiKey_Delete key ownership in InputTextEx like so:
if (g.ActiveId == id)
{
// Declare some inputs, the other are registered and polled via Shortcut() routing system.
...
SetKeyOwner(ImGuiKey_Delete, id); // this will fix itSetKeyOwner(ImGuiKey_Enter, id);
SetKeyOwner(ImGuiKey_KeypadEnter, id);
SetKeyOwner(ImGuiKey_Home, id);
SetKeyOwner(ImGuiKey_End, id);
if (is_multiline)
{
SetKeyOwner(ImGuiKey_PageUp, id);
SetKeyOwner(ImGuiKey_PageDown, id);
}
...
}
Can this key ownership be added, or is there a reason why it wasn't added before?
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
No response
The text was updated successfully, but these errors were encountered:
Thank you for reporting and investigating this. I have pushed a fix: 661bba0 for this and a few other keys.
Those calls are only necessary because they relate to keys for which InputText is not using Shortcut() for. So ideally we'll narrow the set down.
Thanks!
Version/Branch of Dear ImGui:
Version 1.90.9, Branch: docking
Back-ends:
imgui_impl_osx.mm + imgui_impl_win32.cpp
Compiler, OS:
Windows11, VS2022; MacOS 15.0, Xcode16
Full config/build information:
Details:
We are creating a node editor, where nodes can contain controls inside of them.
To handle deleting of nodes, we use the shortcut on the window in which we draw the node editor.
However, we noticed that when we have an active text edit (via InputText for example), selecting text and pressing the delete keyboard button, would not only delete the text, but still trigger the deletion shortcut on the window, even though it is not focused (the focus is in the text edit).
After some debugging, we found that the InputText widget doesn't set key ownership on the delete key when it is active.
This is fixed by adding ImGuiKey_Delete key ownership in InputTextEx like so:
Can this key ownership be added, or is there a reason why it wasn't added before?
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
No response
The text was updated successfully, but these errors were encountered: