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

richtextbox keyboard shortcuts

4 Answers 162 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Pawel
Top achievements
Rank 1
Pawel asked on 27 Nov 2010, 01:57 PM
I'm using RadRichTextBox with RibbonBar (Q3 release).

The problem is that i want to localize my editor to use Polish special characters. But when i'm typing shortcut like alt-l (which should display char) the command 'align left' is firing instead of putting char in the editor.

How can i disable shorcuts in radrichtextbox? Maybe even better - how to assing them only to left ctrl key? (now they are firing with both ctrl and alt keys)

4 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 29 Nov 2010, 03:20 PM
Hello Pawel,

Unfortunately, we do not support customization for the way key bindings work as of now. We are considering providing this functionality for one of the service packs.
If you have any other questions/ suggestions, do not hesitate to contact us again.

Kind regards,
Iva
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Paweł
Top achievements
Rank 1
answered on 22 Sep 2011, 12:10 PM
Hello!
I've got the same problem. Is any possibility to switch off Alt+E and Alt+L combinations to put default, system, chars?
If not... Well...
Ssiecie :)
0
Pawel
Top achievements
Rank 1
answered on 22 Sep 2011, 12:43 PM
Hi,

My solution was to disable all ALT-x shortcuts (polish chars are still working)

private void editor_PreviewEditorKeyDown(object sender, PreviewEditorKeyEventArgs e)
      {
          if ((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt)
          {
              e.SuppressDefaultAction = true;
          }
      }

Hope that helps.

Trochę ssą ;p

0
Iva Toteva
Telerik team
answered on 22 Sep 2011, 12:58 PM
Hi Paweł,

The default input bindings and the customization options are described in this article.

The situation with the input bindings in different languages seems to be a rather complicated one, because depending on the keyboard (e.g. English or Polish Programmers), different ModifierKeys are sent to the PreviewKeyDown/KeyDown. Therefore, overriding the default key binding for all languages will not be the best solution.

We would suggest that you follow the approach that Pawel pointed above:

private void editor_PreviewEditorKeyDown(object sender, PreviewEditorKeyEventArgs e)
{
    if(Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && Keyboard.Modifiers.HasFlag(ModifierKeys.Control))
    {
        e.SuppressDefaultAction = true;
    }           
}

The only difference from his code is that we also check if Control is pressed, because it seems that pressing Right Alt results in both flags being raised.
All the best,
Iva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
Pawel
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Paweł
Top achievements
Rank 1
Pawel
Top achievements
Rank 1
Share this question
or