Exemple #1
0
        public void MyEditBoxCallback(EditBoxWidget edit)
        {
            if (edit.ID != 0)
            {
                return;
            }

            ShowDropDown = !listboxwidget.Visible;
        }
Exemple #2
0
        private void EditBoxCallbackEnterKey(EditBoxWidget edit)
        {
            MultiBoxEditBoxWidget.EditBoxCallback enterkeycallback = this.enterkeycallback;
            if (enterkeycallback == null)
            {
                return;
            }

            enterkeycallback(this);
        }
Exemple #3
0
        private void EditBoxCallbackOnClick(EditBoxWidget edit)
        {
            edit.Text = "";
            MultiBoxEditBoxWidget.EditBoxCallback clickkeycallback = this.clickkeycallback;
            if (clickkeycallback == null)
            {
                return;
            }

            clickkeycallback(this);
        }
Exemple #4
0
        private void EditBoxCallbackEnterKeyOnTextAdded(EditBoxWidget edit)
        {
            if (edit.Text.Length == edit.MAX_CHARS)
            {
                var num = edit.ID - 1000;
                if (num < editboxes.Length - 1)
                {
                    host.SetFocus(editboxes[num + 1]);
                }
            }
            MultiBoxEditBoxWidget.EditBoxCallback onnewtext = this.onnewtext;
            if (onnewtext == null)
            {
                return;
            }

            onnewtext(this);
        }
Exemple #5
0
        private void EditBoxCallbackOnBackSpace(EditBoxWidget edit)
        {
            var cursor = edit.Cursor;

            if (!string.IsNullOrEmpty(edit.Text) || edit.Cursor != 0)
            {
                return;
            }

            var index = edit.ID - 1000 - 1;

            if (index < 0)
            {
                return;
            }

            host.SetFocus(editboxes[index]);
        }
Exemple #6
0
 public ComboBoxWidget(int ID, Element2D parent)
     : base(ID, parent)
 {
     dropdown_height = 96;
     listboxwidget   = new ListBoxWidget(2);
     buttonwidget    = new ButtonWidget(1);
     editboxwidget   = new EditBoxWidget(0);
     editboxwidget.SetCallbackOnClick(new EditBoxWidget.EditBoxCallback(MyEditBoxCallback));
     buttonwidget.DontMove = true;
     buttonwidget.SetCallback(new ButtonCallback(MyButtonCallback));
     listboxwidget.Visible = false;
     editboxwidget.Enabled = true;
     editboxwidget.Text    = "";
     ShowDropDown          = false;
     ChildList             = ChildList + listboxwidget;
     ChildList             = ChildList + buttonwidget;
     ChildList             = ChildList + editboxwidget;
 }
Exemple #7
0
        private void Initialize(int num)
        {
            var num1 = 1.0 - (num - 1.0) * 0.100000001490116;
            var num2 = 0.1f;
            var num3 = (double)num;
            var num4 = (float)(num1 / num3);
            var num5 = 0.0f;

            editboxes = new EditBoxWidget[num];
            for (var index = 0; index < num; ++index)
            {
                var editBoxWidget = new EditBoxWidget(index + 1000, this);
                editBoxWidget.Init(host, "guicontrols", 640f, 448f, 672f, 480f);
                editBoxWidget.SetGrowableWidth(4, 4, 32);
                editBoxWidget.Text = "";
                editBoxWidget.OnKeyboardEvent(new KeyboardEvent(KeyboardEventType.InputKey, false, false, false));
                editBoxWidget.Enabled = true;
                editBoxWidget.SetSize(100, 24);
                editBoxWidget.Color = Color;
                editBoxWidget.SetTextWindowBorders(7, 7, 7, 7);
                editBoxWidget.RelativeX      = num5;
                editBoxWidget.RelativeY      = 0.0f;
                editBoxWidget.RelativeWidth  = num4;
                editBoxWidget.RelativeHeight = 1f;
                editBoxWidget.Size           = FontSize.Large;
                editBoxWidget.CAPS           = true;
                editBoxWidget.SetCallbackEnterKey(new EditBoxWidget.EditBoxCallback(EditBoxCallbackEnterKey));
                editBoxWidget.SetCallbackOnClick(new EditBoxWidget.EditBoxCallback(EditBoxCallbackOnClick));
                editBoxWidget.SetCallbackOnTextAdded(new EditBoxWidget.EditBoxCallback(EditBoxCallbackEnterKeyOnTextAdded));
                editBoxWidget.SetCallbackOnBackspace(new EditBoxWidget.EditBoxCallback(EditBoxCallbackOnBackSpace));
                editBoxWidget.MAX_CHARS = MaxCharacterPerBox;
                num5 += num2 + num4;
                AddChildElement(editBoxWidget);
                editboxes[index] = editBoxWidget;
            }
            initialized = true;
        }