Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return key #6

Closed
fxgenstudio opened this issue Nov 27, 2017 · 3 comments
Closed

Return key #6

fxgenstudio opened this issue Nov 27, 2017 · 3 comments

Comments

@fxgenstudio
Copy link

Return key does not work for me ...

@fxgenstudio
Copy link
Author

ok i found it !

In ImGui_ImplSdl_ProcessEvent() function

I need to add Return key to io.InputChar

    ...
    case SDL_KEYUP:
{
	int key = event->key.keysym.sym & ~SDLK_SCANCODE_MASK;
	io.KeysDown[key] = (event->type == SDL_KEYDOWN);
	io.KeyShift = ((SDL_GetModState() & KMOD_SHIFT) != 0);
	io.KeyCtrl = ((SDL_GetModState() & KMOD_CTRL) != 0);
	io.KeyAlt = ((SDL_GetModState() & KMOD_ALT) != 0);
	io.KeySuper = ((SDL_GetModState() & KMOD_GUI) != 0);

	if (event->key.keysym.scancode == SDL_SCANCODE_RETURN && event->type == SDL_KEYDOWN)
		io.AddInputCharactersUTF8("\r");

	return true;
}

@BalazsJako
Copy link
Owner

Yes, it is treated as any other character.

@onqtam
Copy link
Contributor

onqtam commented Dec 26, 2017

Hi!

Return doesn't work for me either (using the glfw setup code from the imgui project - as seen here)

EDIT:

I also fixed my problem the same way:

void RCRL_ImGui_ImplGlfwGL2_KeyCallback(GLFWwindow* w, int key, int code, int action, int mods)
{
    // call the callback provided by imgui
    ImGui_ImplGlfwGL2_KeyCallback(w, key, code, action, mods);
    
    ImGuiIO& io = ImGui::GetIO();
    if (key == GLFW_KEY_ENTER && (action == GLFW_PRESS || action == GLFW_REPEAT))
        io.AddInputCharacter((unsigned short)'\r');
}

// later in main()
glfwSetKeyCallback(window, RCRL_ImGui_ImplGlfwGL2_KeyCallback);

luis605 added a commit to luis605/ImGuiColorTextEdit that referenced this issue Jan 9, 2024
…son-develop/docs/mkdocs/tornado-6.3.3

Bump tornado from 6.2 to 6.3.3 in /include/json-develop/docs/mkdocs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants