Example #1
0
        /// <summary>
        /// Finish editing by trying to accept the new text.
        /// </summary>
        /// <remarks>
        /// Basically this just calls <see cref="DoAcceptText"/>
        /// </remarks>
        public void AcceptText(TextEditingReason reason)
        {
            switch (reason)
            {
            case TextEditingReason.MouseDown:
                if (this.State == TextEditingState.Validated ||
                    this.State == TextEditingState.Editing2)
                {
                    this.TextEditor.Focus();
                }
                else if (this.State == TextEditingState.Active ||
                         this.State == TextEditingState.Editing)
                {
                    this.State = TextEditingState.Validating;
                    DoAcceptText();
                }
                break;

            case TextEditingReason.LostFocus:
            case TextEditingReason.Enter:
            case TextEditingReason.Tab:
                if (this.State == TextEditingState.Active ||
                    this.State == TextEditingState.Editing)
                {
                    this.State = TextEditingState.Validating;
                    DoAcceptText();
                }
                break;
            }
        }
 /// <summary>
 /// Finish editing by trying to accept the new text.
 /// </summary>
 /// <remarks>
 /// Basically this just calls <see cref="DoAcceptText"/>
 /// </remarks>
 public void AcceptText(TextEditingReason reason) {
   switch (reason) {
     case TextEditingReason.MouseDown:
       if (this.State == TextEditingState.Validated ||
           this.State == TextEditingState.Editing2) {
         this.TextEditor.Focus();
       } else if (this.State == TextEditingState.Active ||
                  this.State == TextEditingState.Editing) {
                  this.State = TextEditingState.Validating;
         DoAcceptText();
       }
       break;
     case TextEditingReason.LostFocus:
     case TextEditingReason.Enter:
     case TextEditingReason.Tab:
       if (this.State == TextEditingState.Active ||
           this.State == TextEditingState.Editing) {
         this.State = TextEditingState.Validating;
         DoAcceptText();
       }
       break;
   }
 }