AcceptsTab not working on WinForms RadRichTextBox

4 posts, 2 answers
  1. Benjamin
    Benjamin avatar
    2 posts
    Member since:
    Feb 2012

    Posted 09 Mar 2012 Link to this post

    Pressing the tab key while the RadRichTextBox has focus, always takes the focus away from the control, even when AcceptsTab is set to true.
    Am I missing something? Please help.
  2. Answer
    Svett
    Admin
    Svett avatar
    728 posts

    Posted 13 Mar 2012 Link to this post

    Hello Benjamin,

    I managed to reproduce the issue. I added it to our public issue tracking system and it will be addressed in one of the next releases. In the meantime, you should use the following work around:

    public class MyRadRichTextBox : RadRichTextBox
    {
        public override string ThemeClassName
        {
            get
            {
                return typeof(RadRichTextBox).FullName;
            }
            set
            {
                base.ThemeClassName = value;
            }
        }
     
        protected override bool IsInputKey(Keys keyData)
        {
            if (keyData == Keys.Tab)
            {
                if (this.AcceptsTab)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
     
            return base.IsInputKey(keyData);
        }
    }

    I updated your Telerik points.

    Greetings,
    Svett
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Benjamin
    Benjamin avatar
    2 posts
    Member since:
    Feb 2012

    Posted 14 Mar 2012 Link to this post

    That worked. Many thanks!
  5. Answer
    Martin Horst
    Martin Horst avatar
    39 posts
    Member since:
    Apr 2010

    Posted 23 Apr 2013 Link to this post

    Hi,

    in my case AcceptsReturn isn't working either. I have a normal modal Windows Form with an Accept and a Cancel Button. Hitting Return results in that the Form is closed. I've added the following code in the Windows Form as workaround:

    protected override bool ProcessDialogKey(Keys keyData)
    {
      if ( keyData == Keys.Return && this.radRichTextBox.Focused )
      {
        this.radRichTextBox.InsertLineBreak();
        return true;
      }
     
      return base.ProcessDialogKey(keyData);
    }

    Best regards
    Martin
Back to Top