Navigation using Tab Key with InputTextMultiline and ImGuiConfigFlags_NavEnableKeyboard, not detecting new line #6802

Closed
opened 2023-09-10 11:19:00 +00:00 by alattanzio · 3 comments
alattanzio commented 2023-09-10 11:19:00 +00:00 (Migrated from github.com)

Hi there,

I've found an issue which happens only with ImGuiConfigFlags_NavEnableKeyboard set.
The navigation happens with Tab Key and focus changes, but somehow the Enter button (New Line) on the InputTextMultiline is not detected, unless Enter is held down.
Is there any way to fix it ?

Example:

static bool p_open = true;
static char strFeedback[1024];
if (ImGui::Begin("Feedback", p_open, 0))
{
    ImGui::InputTextMultiline("##feedback", &strFeedback[0], IM_ARRAYSIZE(strFeedback), ImVec2(0, 120), text_flags);
    if (ImGui::Button("Send!###send"))
    {
        // send message
    }
}
ImGui::End();

Thanks, Antonio.

UPDATE:
This issue actually happens when the control InputTextMultiline is focused. Otherwise works all fine.

Focused (not working properly)
image
Not-Focused (WORKING!)
image

Hi there, I've found an issue which happens only with ImGuiConfigFlags_NavEnableKeyboard set. The navigation happens with Tab Key and focus changes, but somehow the Enter button (New Line) on the InputTextMultiline is not detected, unless Enter is held down. Is there any way to fix it ? Example: static bool p_open = true; static char strFeedback[1024]; if (ImGui::Begin("Feedback", p_open, 0)) { ImGui::InputTextMultiline("##feedback", &strFeedback[0], IM_ARRAYSIZE(strFeedback), ImVec2(0, 120), text_flags); if (ImGui::Button("Send!###send")) { // send message } } ImGui::End(); Thanks, Antonio. UPDATE: This issue actually happens when the control InputTextMultiline is focused. Otherwise works all fine. Focused (not working properly) ![image](https://github.com/ocornut/imgui/assets/38122259/50b25b05-ad83-46bd-8bc4-87f3b9d2bcee) Not-Focused (WORKING!) ![image](https://github.com/ocornut/imgui/assets/38122259/4f9a9d91-8011-44bf-898b-50bfcbbd57f1)
ocornut commented 2023-09-11 09:46:12 +00:00 (Migrated from github.com)

Thank you for reporting.
I have pushed a fix for this 0e1ce76.
Amusingly we had a comment directly the double activation as "Harmless but bizarre." but it turned out not to be harmless.

Pushed an automated regression test to TestEngine:
ocornut/imgui_test_engine@478329f02f

The fact the the navigation system only emits the g.NavActivateId signal (on space or enter) when g.NavDisableHighlight == false is probably to be reworked and currently creates some inconsistency. I guess when ImGuiConfigFlags_NavEnableKeyboard is set we should always restore the highlight on tabbing.

Thank you for reporting. I have pushed a fix for this 0e1ce76. Amusingly we had a comment directly the double activation as "Harmless but bizarre." but it turned out not to be harmless. Pushed an automated regression test to TestEngine: https://github.com/ocornut/imgui_test_engine/commit/478329f02f09c38a7c353851c64b3fc4915c2ef3 The fact the the navigation system only emits the `g.NavActivateId` signal (on space or enter) when `g.NavDisableHighlight == false` is probably to be reworked and currently creates some inconsistency. I guess when `ImGuiConfigFlags_NavEnableKeyboard` is set we should always restore the highlight on tabbing.
ocornut commented 2023-09-11 10:14:27 +00:00 (Migrated from github.com)

The fact the the navigation system only emits the g.NavActivateId signal (on space or enter) when g.NavDisableHighlight == false is probably to be reworked and currently creates some inconsistency. I guess when ImGuiConfigFlags_NavEnableKeyboard is set we should always restore the highlight on tabbing.

Also pushed a change for that: b9ab6e2

> The fact the the navigation system only emits the g.NavActivateId signal (on space or enter) when g.NavDisableHighlight == false is probably to be reworked and currently creates some inconsistency. I guess when ImGuiConfigFlags_NavEnableKeyboard is set we should always restore the highlight on tabbing. Also pushed a change for that: b9ab6e2
alattanzio commented 2023-09-11 11:39:14 +00:00 (Migrated from github.com)

That's great! Thank you so much! It was driving me crazy :) Cheers!

That's great! Thank you so much! It was driving me crazy :) Cheers!
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#6802
No description provided.