Exemplo n.º 1
0
        ////////////////

        /// @private
        public override void OnBind()
        {
            base.OnBind();

            //this.TextDisplayFunction = () => this.labelAttribute?.Label ?? this.memberInfo.Name + ": " + this.GetValue();

            ////

            this.InputElem = new UITextInputPanel(UITheme.Vanilla, "Enter decimal");
            this.InputElem.Width.Set(184f, 0f);
            this.InputElem.Height.Set(32f, 0f);
            this.InputElem.Left.Set(-92f, 0.5f);
            //this.InputElem.SetPadding( 2f );
            this.InputElem.OnUnfocus += () => {
                float val;
                if (float.TryParse(this.InputElem.GetText(), out val))
                {
                    base.SetObject(val);
                }
                else
                {
                    this.InputElem.SetText(this.GetObject() + "");
                }
            };
            this.Append(this.InputElem);

            ////

            this.InputElem.SetText(this.GetObject().ToString());
        }
        ////////////////

        /// <summary>
        /// Applies standard text input theming to a UI text field.
        /// </summary>
        /// <param name="panel"></param>
        public virtual void ApplyInput(UITextInputPanel panel)
        {
            panel.BackgroundColor = this.InputBgColor;
            panel.BorderColor     = this.InputEdgeColor;
            panel.TextColor       = this.InputTextColor;
        }