Exemple #1
0
        public DecimalNumericEdit(EditBox edit)
        {
            this.edit   = edit;
            lastCaption = edit.Caption;
            edit.EventEditTextChange     += new MyGUIEvent(edit_EventEditTextChange);
            edit.MouseWheel              += new MyGUIEvent(edit_MouseWheel);
            edit.ClientWidget.MouseWheel += new MyGUIEvent(edit_MouseWheel);
            edit.KeyLostFocus            += new MyGUIEvent(edit_KeyLostFocus);
            edit.KeySetFocus             += new MyGUIEvent(edit_KeySetFocus);
            edit.EventEditSelectAccept   += new MyGUIEvent(edit_EventEditSelectAccept);
            edit.AllowMouseScroll         = false;
            Increment = 1;
            FireValueChangedOnType = false;

            //MinValue
            String userString = edit.getUserString("MinValue");

            if (userString == null || !NumberParser.TryParse(userString, out minValue))
            {
                minValue = Decimal.MinValue;
            }

            //MaxValue
            userString = edit.getUserString("MaxValue");
            if (userString == null || !NumberParser.TryParse(userString, out maxValue))
            {
                maxValue = Decimal.MaxValue;
            }
        }
Exemple #2
0
        public InputBox(String title, String message, String text, String customLayout)
            : base(customLayout)
        {
            input                   = window.findWidget("Input") as EditBox;
            input.Caption           = text;
            input.KeyButtonPressed += input_KeyButtonPressed;

            prompt = window.findWidget("Prompt") as TextBox;
            //Figure out the size difference of the prompt and window
            minimumWidth = window.Width;
            deltaSize    = new Size2(window.Width - prompt.Width, window.Height - prompt.Height);
            Message      = message;

            window.Caption = title;

            Button ok = window.findWidget("Ok") as Button;

            ok.MouseButtonClick += new MyGUIEvent(ok_MouseButtonClick);

            Button cancel = window.findWidget("Cancel") as Button;

            cancel.MouseButtonClick += new MyGUIEvent(cancel_MouseButtonClick);

            Accepted = false;
        }
 private void ensureEditWidgetExists(Widget parentWidget)
 {
     if (editWidget == null)
     {
         editWidget = parentWidget.createWidgetT("EditBox", "EditBox", Position.x, Position.y, Size.Width, Size.Height, Align.Default, "") as EditBox;
         editWidget.KeyLostFocus      += new MyGUIEvent(editWidget_KeyLostFocus);
         editWidget.KeyButtonReleased += new MyGUIEvent(editWidget_KeyButtonReleased);
         editWidget.OnlyText           = value;
         editWidget.Visible            = false;
     }
 }
Exemple #4
0
 void changeKeyFocus(Widget widget)
 {
     EditBox editBox = widget as EditBox;
     if (editBox != null && !editBox.EditStatic)
     {
         onscreenKeyboardManager.KeyboardMode = editBox.EditPassword ? OnscreenKeyboardMode.Secure : OnscreenKeyboardMode.Normal;
     }
     else
     {
         onscreenKeyboardManager.KeyboardMode = OnscreenKeyboardMode.Hidden;
     }
 }
 public override void Dispose()
 {
     if (editWidget != null)
     {
         Gui.Instance.destroyWidget(editWidget);
         editWidget = null;
     }
     if (staticWidget != null)
     {
         Gui.Instance.destroyWidget(staticWidget);
         staticWidget = null;
     }
 }
        public DateControl(ComboBox month, ComboBox day, EditBox year)
        {
            this.month = month;
            int i = 1;

            foreach (String monthName in CultureInfo.CurrentCulture.DateTimeFormat.AbbreviatedMonthNames)
            {
                if (!String.IsNullOrEmpty(monthName))
                {
                    month.addItem(monthName, i++);
                }
            }
            month.SelectedIndex             = 0;
            month.EventComboChangePosition += new MyGUIEvent(month_EventComboChangePosition);
            this.day                = day;
            this.year               = new NumericEdit(year);
            this.year.MinValue      = 1;
            this.year.MaxValue      = 9999;
            this.year.AllowFloat    = false;
            this.year.ValueChanged += new MyGUIEvent(year_ValueChanged);
            populateMonthDays();
        }
        public TimelineDataProperties(ScrollView propScroll, TimelineView timelineView)
        {
            this.propScroll   = propScroll;
            this.timelineView = timelineView;
            timelineView.ActiveDataChanged += new EventHandler(timelineView_ActiveDataChanged);

            startTime = new NumericEdit(propScroll.findWidget("StartTime") as EditBox);
            startTime.ValueChanged += new MyGUIEvent(startTime_ValueChanged);
            startTime.MaxValue      = float.MaxValue;

            EditBox durationEdit = propScroll.findWidget("Duration") as EditBox;

            if (durationEdit != null)
            {
                duration = new NumericEdit(durationEdit);
                duration.ValueChanged       += new MyGUIEvent(duration_ValueChanged);
                duration.MaxValue            = float.MaxValue;
                additionalPropertiesPosition = new IntVector2(1, duration.Edit.Bottom + 2);
            }
            else
            {
                additionalPropertiesPosition = new IntVector2(1, startTime.Edit.Bottom + 2);
            }
        }
Exemple #8
0
 public DecimalNumericEdit(EditBox edit, Button upButton, Button downButton)
     : this(edit)
 {
     upButton.MouseButtonClick   += new MyGUIEvent(upButton_MouseButtonClick);
     downButton.MouseButtonClick += new MyGUIEvent(downButton_MouseButtonClick);
 }
 public Int32NullableNumericEdit(EditBox edit, Button upButton, Button downButton)
     : this(edit)
 {
     upButton.MouseButtonClick   += new MyGUIEvent(upButton_MouseButtonClick);
     downButton.MouseButtonClick += new MyGUIEvent(downButton_MouseButtonClick);
 }