protected override bool ValidateFinalString(string value) { if (NumericTextField.CheckIfRatio(value, ValidationType.Decimal, false) || NumericTextField.CheckIfNumber(value, ValidationType.Decimal, false)) { return(true); } return(false); }
public NumericSpinEditor() { TranslatesAutoresizingMaskIntoConstraints = false; var controlSize = NSControlSize.Small; stepper = new NSStepper { TranslatesAutoresizingMaskIntoConstraints = false, ValueWraps = false, ControlSize = controlSize, }; formatter = new NSNumberFormatter { FormatterBehavior = NSNumberFormatterBehavior.Version_10_4, Locale = NSLocale.CurrentLocale, MaximumFractionDigits = 15, NumberStyle = NSNumberFormatterStyle.Decimal, UsesGroupingSeparator = false, }; numericEditor = new NumericTextField { Alignment = NSTextAlignment.Right, Formatter = formatter, TranslatesAutoresizingMaskIntoConstraints = false, Font = NSFont.FromFontName(PropertyEditorControl.DefaultFontName, PropertyEditorControl.DefaultFontSize), ControlSize = controlSize, }; stepper.Activated += (s, e) => { OnStepperActivated(s, e); }; numericEditor.KeyArrowUp += (sender, e) => { IncrementNumericValue(); }; numericEditor.KeyArrowDown += (sender, e) => { DecrementNumericValue(); }; numericEditor.ValidatedEditingEnded += (s, e) => { OnEditingEnded(s, e); }; AddSubview(stepper); AddSubview(numericEditor); this.DoConstraints(new[] { numericEditor.ConstraintTo(this, (n, c) => n.Width == c.Width - 16), numericEditor.ConstraintTo(this, (n, c) => n.Height == 19), stepper.ConstraintTo(numericEditor, (s, n) => s.Left == n.Right + 4), stepper.ConstraintTo(numericEditor, (s, n) => s.Top == n.Top), }); }
public RatioValidateDelegate(NumericTextField textField) : base(textField) { }
protected override bool ValidateFinalString(string value) { return(TextField.NumericMode == ValidationType.Decimal ? NumericTextField.ValidateDecimal(value, TextField.AllowNegativeValues) : NumericTextField.ValidateInteger(value, TextField.AllowNegativeValues)); }
public NumericValidationDelegate(NumericTextField textField) : base(textField) { }
public TextViewValidationDelegate(NumericTextField textField) { TextField = textField; }