예제 #1
0
        public InputSet(string name, int?valueWidth = null)
        {
            Name  = new FixedLengthLabel(name);
            Value = new TextField("")
            {
                X = Pos.Right(Name)
            };
            if (valueWidth != null)
            {
                Value.Width = valueWidth.Value;
            }

            Add(Name, Value);

            Width  = Dim.Width(Name) + Dim.Width(Value);
            Height = Name.Height;
        }
        public InputSetWithValidation(string name, string errorText, string successText, Predicate <string> validator, int?valueWidth = null) : base(name, valueWidth)
        {
            _validator   = validator;
            _errorText   = errorText;
            _successText = successText;
            ErrorText    = new FixedLengthLabel(errorText)
            {
                X         = Pos.Right(Value),
                Width     = errorText.Length,
                TextColor = _errorColor
            };

            Value.Changed += Value_Changed;

            Add(ErrorText);

            Width  = Dim.Width(Name) + Dim.Width(Value) + Dim.Width(ErrorText);
            Height = Name.Height;
        }