/// <summary> Constructor with name, bounds and optional text </summary>
 public GLTextBoxAutoComplete(string name, Rectangle pos, string text = "") : base(name, pos, text)
 {
     MultiLineMode                 = false;
     waitforautotimer.Tick        += InitialDelayOver;
     autocompleteinuitimer.Tick   += AutoCompleteInUI;
     triggercomplete.Tick         += AutoCompleteFinished;
     ListBox.AutoSize              = true;
     ListBox.SelectedIndexChanged += (c0, i) => {
         Text = ListBox.SelectedItem;
         CancelAutoComplete();
         SelectedEntry?.Invoke(this);
     };
     ListBox.OtherKeyPressed += (c1, e) => { if (e.KeyCode == System.Windows.Forms.Keys.Delete)
                                             {
                                                 CancelAutoComplete();
                                             }
     };
     ListBox.Name               = name + "_LB";
     ListBox.TopMost            = true;
     ListBox.ShowFocusHighlight = true;
 }
        /// <inheritdoc cref="GLOFC.GL4.Controls.GLBaseControl.OnKeyDown(GLKeyEventArgs)"/>
        protected override void OnKeyDown(GLKeyEventArgs e)
        {
            base.OnKeyDown(e);
            if (!e.Handled)
            {
                if (ListBox.Visible)
                {
                    if (e.KeyCode == System.Windows.Forms.Keys.Up)
                    {
                        ListBox.FocusUp();
                    }
                    else if (e.KeyCode == System.Windows.Forms.Keys.Down)
                    {
                        ListBox.FocusDown();
                    }
                    else if (e.KeyCode == System.Windows.Forms.Keys.PageUp)
                    {
                        ListBox.FocusUp(ListBox?.DisplayableItems ?? 0);
                    }
                    else if (e.KeyCode == System.Windows.Forms.Keys.PageDown)
                    {
                        ListBox.FocusDown(ListBox?.DisplayableItems ?? 0);
                    }
                }

                if (e.KeyCode == System.Windows.Forms.Keys.Enter || e.KeyCode == System.Windows.Forms.Keys.Return)
                {
                    if (ListBox.Visible && ListBox.FocusIndex >= 0)       // if we are showing list and there is a focus, we use that
                    {
                        ListBox.SelectCurrentFocus();
                    }
                    else
                    {
                        CancelAutoComplete();                   // close any list box, and select this text, may be empty
                        SelectedEntry?.Invoke(this);
                    }
                }
            }
        }