Last active
September 12, 2025 18:04
-
-
Save ocornut/72dff3fff224205f4b7149708c629d4c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Small hack for a resizable InputTextMultiline() | |
ImVec2 SetInputTextMultilineResizableY(const char* label, const ImVec2& base_size) | |
{ | |
ImVec2 pos = ImGui::GetCursorScreenPos(); | |
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, { 0.0f, 0.0f }); | |
ImGui::BeginChild(label, base_size, ImGuiChildFlags_ResizeY | ImGuiChildFlags_FrameStyle | ImGuiChildFlags_Borders); | |
ImVec2 actual_size = ImGui::GetWindowSize(); | |
ImGui::EndChild(); | |
ImGui::PopStyleVar(); | |
ImGui::SetCursorScreenPos(pos); | |
return actual_size; | |
} | |
// Usage | |
static char buf[10000] = ""; | |
ImVec2 size = SetInputTextMultilineResizableY("##test", { -FLT_MIN, 200.0f }); | |
ImGui::InputTextMultiline("##test", buf, IM_ARRAYSIZE(buf), size); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment