This is a migrated thread and some comments may be shown as answers.

AcceptsTab not working on WinForms RadRichTextBox

3 Answers 105 Views
RichTextBox (obsolete as of Q3 2014 SP1)
This is a migrated thread and some comments may be shown as answers.
Benjamin
Top achievements
Rank 1
Benjamin asked on 09 Mar 2012, 03:18 PM
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.

3 Answers, 1 is accepted

Sort by
0
Accepted
Svett
Telerik team
answered on 13 Mar 2012, 10:47 AM
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 >>
0
Benjamin
Top achievements
Rank 1
answered on 14 Mar 2012, 08:19 PM
That worked. Many thanks!
0
Accepted
Martin Horst
Top achievements
Rank 1
answered on 23 Apr 2013, 06:01 AM
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
Tags
RichTextBox (obsolete as of Q3 2014 SP1)
Asked by
Benjamin
Top achievements
Rank 1
Answers by
Svett
Telerik team
Benjamin
Top achievements
Rank 1
Martin Horst
Top achievements
Rank 1
Share this question
or