From c146b2d9509b6e26ae5c2736c422255153e6b756 Mon Sep 17 00:00:00 2001 From: Demizdor Date: Sat, 11 May 2019 11:18:40 +0300 Subject: [PATCH] Right clicking outside the textbox bounds will deactivate it --- src/raygui.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/raygui.h b/src/raygui.h index a20edf0..a16b099 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -2041,6 +2041,12 @@ RAYGUIDEF bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editM GuiTextBoxSetActive(bounds); } } + else if(!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) + { + // When active and the right mouse is clicked outside the textbox we should deactivate it + GuiTextBoxSetActive((Rectangle){0,0,-1,-1}); // Set a dummy rect as the active textbox bounds + active = false; + } if(active) {