From 07b02e6cf39d8280253b465179ee165fe611462d Mon Sep 17 00:00:00 2001 From: Wojciech Figat Date: Mon, 8 Aug 2022 13:51:55 +0200 Subject: [PATCH] Add option to disable selecting text in text box 5dadaf70f98cb9cde966e93ef4edf69e8f046ac9 --- Source/Engine/UI/GUI/Common/RichTextBoxBase.cs | 2 +- Source/Engine/UI/GUI/Common/TextBox.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/Engine/UI/GUI/Common/RichTextBoxBase.cs b/Source/Engine/UI/GUI/Common/RichTextBoxBase.cs index bfddc966c..4f9e20d5d 100644 --- a/Source/Engine/UI/GUI/Common/RichTextBoxBase.cs +++ b/Source/Engine/UI/GUI/Common/RichTextBoxBase.cs @@ -207,7 +207,7 @@ namespace FlaxEngine.GUI { // Select the word under the mouse int textLength = TextLength; - if (textLength != 0) + if (textLength != 0 && IsSelectable) { var hitPos = CharIndexAtPoint(ref location); int spaceLoc = _text.LastIndexOfAny(Separators, hitPos - 2); diff --git a/Source/Engine/UI/GUI/Common/TextBox.cs b/Source/Engine/UI/GUI/Common/TextBox.cs index 77ca2a258..e11e7c787 100644 --- a/Source/Engine/UI/GUI/Common/TextBox.cs +++ b/Source/Engine/UI/GUI/Common/TextBox.cs @@ -234,7 +234,10 @@ namespace FlaxEngine.GUI /// public override bool OnMouseDoubleClick(Float2 location, MouseButton button) { - SelectAll(); + if (IsSelectable) + { + SelectAll(); + } return base.OnMouseDoubleClick(location, button); }