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

Problems with shortcuts in RadRichTextbox

8 Answers 89 Views
RichTextBox (obsolete as of Q3 2014 SP1)
This is a migrated thread and some comments may be shown as answers.
Lukasz
Top achievements
Rank 1
Lukasz asked on 13 Jul 2012, 12:18 PM
Hi.

I'm a little new in telerik controls, but i have a problem with RichTextbox. When I try to type letter 'ą', which is combination of keys Alt + a, the text in control is selected but I have not the letter 'ą' in my control. Is there any possible to disable shortcuts in RichTextBox ?
Thanks for the response.
Best regards
Lukasz

8 Answers, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 18 Jul 2012, 05:26 AM
Hi Lukasz,

Before I assist you, I would like know how I can enable such a keyboard layout on Windows installation? Do I need to install additional software?

Regards,
Svett
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Lukasz
Top achievements
Rank 1
answered on 18 Jul 2012, 06:17 AM
Hi Svett,

I think no. You must enter in Control Panel -> Clock, Language, and Region -> Change keybords or other input methods. Then, in window "Region and Language", you must select "Keyoards and Languages" page and after that click in "Change keyboards..." button. In section "Installed services" click button "Add..". Next select from this long tree node "Polish" and after expand under "Keyboard" check Polish (Programmers). Uff... a little long ;-)

To enter letter "ą" you must press right Alt key and letter a. Its looks like shortcuts (select, copy)working with Ctrl key and right Alt key.

Best regards
Lukasz
0
Accepted
Svett
Telerik team
answered on 20 Jul 2012, 12:54 PM
Hello Lukasz,

Thank you for detailed illustration. I managed to reproduce your scenario. This happens because of default input logic of RadRichTextBox. You can achieve the desired scenario by creating custom input behavior:
public class RichTextBoxInputBehavior : InputBehavior
{
    public RichTextBoxInputBehavior(DocumentView view)
        : base(view)
    {
 
    }
 
    protected override void PerformSelectAllOperation(KeyEventArgs e)
    {
 
    }
}

Then you should replace the default one:
this.richTextBox.DocumentView.InputBehavior = new RichTextBoxInputBehavior(this.richTextBox.DocumentView);

I hope this helps.

Kind regards,
Svett
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Lukasz
Top achievements
Rank 1
answered on 23 Jul 2012, 07:03 AM
Hi Svett,

Yours solution is working very well. Thank You. Here is full implementation for other Polish people ;-)
public class RichTextBoxInputBehavior : InputBehavior
   {
       public RichTextBoxInputBehavior(DocumentView view)
           : base(view)
       {
 
       }
 
       protected override void PerformSelectAllOperation(KeyEventArgs e)
       {
           if (!e.Alt)
           {
               base.PerformSelectAllOperation(e);
           }
 
       }
 
       protected override void PerformCopyOperation(KeyEventArgs e)
       {
           if (!e.Alt)
           {
               base.PerformCopyOperation(e);
           }
       }
 
       protected override void PerformUndoOperation(KeyEventArgs e)
       {
           if (!e.Alt)
           {
               base.PerformUndoOperation(e);
           }
       }
 
       protected override void PerformCutOperation(KeyEventArgs e)
       {
           if (!e.Alt)
           {
               base.PerformCutOperation(e);
           }
       }
 
       protected override void PerformAlignmentOperation(KeyEventArgs e)
       {
           if (!e.Alt)
           {
               base.PerformAlignmentOperation(e);
           }
       }
   }

Once more - Big Thanks ;-)
Greetings
Lukasz
0
Paweł
Top achievements
Rank 1
answered on 06 Oct 2014, 03:46 PM
Hi,
in WinForm with RadRichTextBox and Polish Programmer keyboard, when I use shortcuts:
alt+e -> expect 'ę' but I get '€ę'
alt+c -> expect 'ć' but I get '©ć'.
I don't need this extra ALT shortcuts like alt+t -> '™'.
I use only in editor shortcuts with control like CTRL+B to bold text.
0
Tomasz
Top achievements
Rank 1
answered on 08 Oct 2014, 12:02 PM
I have the same problem with alt+e and alt+c.
Please help.
0
George
Telerik team
answered on 09 Oct 2014, 07:20 AM
Hello guys,

Thank you for reaching out to us.

In the same InputBehavior which Lukasz provided, you can override the ProcessKeyDownCore method as follows:
public class RichTextBoxInputBehavior : InputBehavior
{
    public RichTextBoxInputBehavior(DocumentView view)
        : base(view)
    {
 
    }
 
    protected override void PerformSelectAllOperation(KeyEventArgs e)
    {
        if (!e.Alt)
        {
            base.PerformSelectAllOperation(e);
        }
 
    }
 
    protected override void PerformCopyOperation(KeyEventArgs e)
    {
        if (!e.Alt)
        {
            base.PerformCopyOperation(e);
        }
    }
 
    protected override void PerformUndoOperation(KeyEventArgs e)
    {
        if (!e.Alt)
        {
            base.PerformUndoOperation(e);
        }
    }
 
    protected override void PerformCutOperation(KeyEventArgs e)
    {
        if (!e.Alt)
        {
            base.PerformCutOperation(e);
        }
    }
 
    protected override void PerformAlignmentOperation(KeyEventArgs e)
    {
        if (!e.Alt)
        {
            base.PerformAlignmentOperation(e);
        }
    }
 
    protected override bool ProcessKeyDownCore(KeyEventArgs e)
    {
        if (e.Control && e.Alt)
        {
            switch (e.KeyCode)
            {
                case Keys.E:
                case Keys.R:
                case Keys.T:
                case Keys.C:
                    return false;
            }
        }
 
        return base.ProcessKeyDownCore(e);
    }
}

Further below, my colleague Svetlin has provided the code needed to register the behavior.

Let me know, should you have further questions.

Regards,
George
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Paweł
Top achievements
Rank 1
answered on 09 Oct 2014, 07:44 AM
It work.
Thank's for solution.
Tags
RichTextBox (obsolete as of Q3 2014 SP1)
Asked by
Lukasz
Top achievements
Rank 1
Answers by
Svett
Telerik team
Lukasz
Top achievements
Rank 1
Paweł
Top achievements
Rank 1
Tomasz
Top achievements
Rank 1
George
Telerik team
Share this question
or