From 947ef5799da4d06cf49b3c8f7987929eb7c99b9c Mon Sep 17 00:00:00 2001 From: Vincent-Dalstra <51883563+Vincent-Dalstra@users.noreply.github.com> Date: Wed, 8 Oct 2025 20:46:29 +0800 Subject: [PATCH] Lock other controls when GuiTextInputBox is open (#512) Previously, the color picker would end up eating inputs intended for the GuiTextInputBox! --- examples/controls_test_suite/controls_test_suite.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/controls_test_suite/controls_test_suite.c b/examples/controls_test_suite/controls_test_suite.c index 9bf057a..1e01a39 100644 --- a/examples/controls_test_suite/controls_test_suite.c +++ b/examples/controls_test_suite/controls_test_suite.c @@ -203,11 +203,12 @@ int main() BeginDrawing(); ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); - + // raygui: controls drawing //---------------------------------------------------------------------------------- // Check all possible events that require GuiLock if (dropDown000EditMode || dropDown001EditMode) GuiLock(); + if (showTextInputBox) GuiLock(); // First GUI column //GuiSetStyle(CHECKBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); @@ -236,7 +237,9 @@ int main() GuiComboBox((Rectangle){ 25, 480, 125, 30 }, "default;Jungle;Lavanda;Dark;Bluish;Cyber;Terminal;Candy;Cherry;Ashes;Enefete;Sunny;Amber", &visualStyleActive); // NOTE: GuiDropdownBox must draw after any other control that can be covered on unfolding - GuiUnlock(); + if (dropDown000EditMode || dropDown001EditMode) GuiUnlock(); + if (showTextInputBox) GuiLock(); // Stay locked + GuiSetStyle(DROPDOWNBOX, TEXT_PADDING, 4); GuiSetStyle(DROPDOWNBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); if (GuiDropdownBox((Rectangle){ 25, 65, 125, 30 }, "#01#ONE;#02#TWO;#03#THREE;#04#FOUR", &dropdownBox001Active, dropDown001EditMode)) dropDown001EditMode = !dropDown001EditMode; @@ -300,6 +303,8 @@ int main() if (showTextInputBox) { + GuiUnlock(); + DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, 0.8f)); int result = GuiTextInputBox((Rectangle){ (float)GetScreenWidth()/2 - 120, (float)GetScreenHeight()/2 - 60, 240, 140 }, GuiIconText(ICON_FILE_SAVE, "Save file as..."), "Introduce output file name:", "Ok;Cancel", textInput, 255, NULL);