[feat] enable Enter key pressing for ImGui::InputText() method

This commit is contained in:
dijunkun
2024-08-08 15:56:20 +08:00
parent b37e08a202
commit 664412dd4e
2 changed files with 11 additions and 6 deletions

View File

@@ -81,14 +81,17 @@ int Render::ConnectionStatusWindow() {
ImGui::SetNextItemWidth(IPUT_WINDOW_WIDTH / 2);
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
ImGui::InputText("##password", (char *)remote_password_.c_str(), 7,
ImGuiInputTextFlags_CharsNoBlank);
bool enter_pressed =
ImGui::InputText("##password", (char *)remote_password_.c_str(), 7,
ImGuiInputTextFlags_CharsNoBlank |
ImGuiInputTextFlags_EnterReturnsTrue);
ImGui::PopStyleVar();
ImGui::SetCursorPosX(window_width * 0.315f);
ImGui::SetCursorPosY(window_height * 0.75f);
// OK
if (ImGui::Button(
if (enter_pressed ||
ImGui::Button(
localization::ok[localization_language_index_].c_str())) {
show_connection_status_window_ = true;
password_validating_ = true;