diff --git a/GraphicsManager/GraphicsManager.csproj b/GraphicsManager/GraphicsManager.csproj index 120b0c6..ab530d8 100644 --- a/GraphicsManager/GraphicsManager.csproj +++ b/GraphicsManager/GraphicsManager.csproj @@ -10,7 +10,7 @@ False https://git.jacobtech.com/JacobTech.com/GraphicsManager git - 1.0.0-alpha4 + 1.0.0-alpha6 diff --git a/GraphicsManager/Objects/Textbox.cs b/GraphicsManager/Objects/Textbox.cs index 17a4e43..6ee83ca 100755 --- a/GraphicsManager/Objects/Textbox.cs +++ b/GraphicsManager/Objects/Textbox.cs @@ -2,6 +2,7 @@ using GraphicsManager.Interfaces; using GraphicsManager.Objects.Core; using OpenTK.Mathematics; +using OpenTK.Windowing.Common; using OpenTK.Windowing.GraphicsLibraryFramework; namespace GraphicsManager.Objects; @@ -110,38 +111,29 @@ public class Textbox : IRenderObject this.Window = Window; this.Window.MouseDown += Window_MouseDown; this.Window.KeyDown += Window_KeyDown; + this.Window.TextInput += WindowOnTextInput; Loaded = true; _bounds.LoadToParent(Parent, Window); _inside.LoadToParent(Parent, Window); _label.LoadToParent(Parent, Window); Location = Location; } + + private void WindowOnTextInput(TextInputEventArgs obj) + { + Text += obj.AsString; + } + private bool use = false; private void Window_KeyDown(OpenTK.Windowing.Common.KeyboardKeyEventArgs obj) { if (!use) return; if (obj.Key == Keys.CapsLock || obj.Key == Keys.Menu || obj.Key == Keys.LeftSuper || obj.Key == Keys.RightSuper || obj.Key == Keys.End || obj.Key == Keys.Home || obj.Key == Keys.PageDown || obj.Key == Keys.PageUp || obj.Key == Keys.Insert || obj.Key == Keys.Up || obj.Key == Keys.Down || obj.Key == Keys.Left || obj.Key == Keys.Right) return; - if (obj.Key == Keys.Backspace) + if (obj.Key == Keys.Backspace || obj.Key == Keys.Delete) { if (!(Text.Length > 0)) return; Text = Text.Remove(Text.Length - 1, 1); } - else if (obj.Key == Keys.Delete) - { - if (!(Text.Length > 0)) return; - Text = Text.Remove(Text.Length - 1, 1); - } - else if (obj.Shift) - { - if (obj.Key == Keys.Enter || obj.Key == Keys.KeyPadEnter) Text += '\n'; - else if (obj.Key == Keys.LeftShift || obj.Key == Keys.KeyPadEnter || obj.Key == Keys.Enter || obj.Key == Keys.End || obj.Key == Keys.Down) return; - else Text += ((char)obj.Key).ToString().ToUpper(); - } - else if (obj.Command || obj.Alt || obj.Control) { } - else - { - Text += ((char)obj.Key).ToString().ToLower(); - } } private void Window_MouseDown(OpenTK.Windowing.Common.MouseButtonEventArgs e)