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

Accelerator/Shortcut Keys Issue

2 Answers 145 Views
RichTextBox (obsolete as of Q3 2014 SP1)
This is a migrated thread and some comments may be shown as answers.
Aaron
Top achievements
Rank 1
Aaron asked on 02 May 2012, 10:29 PM
Hello, I just ran into this issue and it took me forever to figure it out. I figured I would post it here in the hopes of saving someone a headache.

I have created a custom control that contains a RadRichTextBox and a RadCommandBar

I dropped the custom control onto a new windows form along with several standard textboxes and labels

I added accelerator characters to the labels of the text boxes "&Company", "&Employee".

When I ran the form and began typing into the RadRichTextBox whenever I typed "c" or "e" (without pushing "Alt") the focus would move to the text boxes with the matching accelerator key.

To get around this I needed to add the following override in the custom control.

        protected override bool ProcessDialogChar(char charCode)
        {
            if ((Control.ModifierKeys & Keys.Alt) == Keys.None) return false;
            return base.ProcessDialogChar(charCode);
        }

Hope that helps!

2 Answers, 1 is accepted

Sort by
0
Accepted
Jack
Telerik team
answered on 07 May 2012, 01:51 PM
Hello Aaron,

Thank you for sharing your solution with the community. I marked this as an issue and logged it in our issue tracking system. I have also updated your Telerik account for bringing this to our attention.

If you need further assistance, I will be glad to help.
 
Regards,
Jack
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
NORIS
Top achievements
Rank 1
answered on 05 Nov 2012, 02:35 PM
Thank you, Aaron. Your code also resolved this issue for me.
I voted for the fix.
Tags
RichTextBox (obsolete as of Q3 2014 SP1)
Asked by
Aaron
Top achievements
Rank 1
Answers by
Jack
Telerik team
NORIS
Top achievements
Rank 1
Share this question
or