Exemplo n.º 1
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;
 }
Exemplo n.º 2
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;
        }