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

€ character

3 Answers 81 Views
RichTextBox (obsolete as of Q3 2014 SP1)
This is a migrated thread and some comments may be shown as answers.
Michael Hilgers
Top achievements
Rank 1
Michael Hilgers asked on 12 Apr 2013, 08:54 AM
Hello everyone,

i'm using some RadRichTextBoxes in my application.

Because we're in the European Union, we need the character "€" for currency values like "110,23€".

But for me and my customers, it's not possible to insert a € character into the TextBoxes with the key shortcuts "Ctrl+Alt+E" or "AltGr+E" (which are the standard for inserting € characters on european keyboard layouts).

How can i modify the behaviour of the TextBoxes so that these standard values are accepted? But i think a cleaner and better solution would be a native support for the € character by Telerik itself because it's a standard character in Europe like the $ character in the US.

Regards,
Michael

3 Answers, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 16 Apr 2013, 01:05 PM
Hello Michael,

Thank you for writing.

You can achieve the desired behavior by creating a custom input handler in the following manner:
public class MyInputBehavior : InputBehavior
{
    public MyInputBehavior(DocumentView view)
        : base(view)
    {
 
    }
 
    protected override bool ProcessKeyDownCore(System.Windows.Forms.KeyEventArgs e)
    {
        if (e.Control && e.Alt && e.KeyCode == System.Windows.Forms.Keys.E)
        {
            this.DocumentView.Insert("€");
            return false;
        }
 
        return base.ProcessKeyDownCore(e);
    }
}

Then you should replace the default instance in the following way:
this.radRichTextBox1.DocumentView.InputBehavior = new MyInputBehavior(this.radRichTextBox1.DocumentView);

I will consider your suggestion as feature request. You can track its status in our public issue tracking system.

I updated your Telerik points.

Greetings,
Svett
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
0
Michael Hilgers
Top achievements
Rank 1
answered on 16 Apr 2013, 01:16 PM
Hello Svett ,

thanks for the reply. Your suggested solution is nearly correct.

Doing it the way you suggest, i get two € characters insted of one when pressing the key combination just once.

I changed the function like this and all works fine:
protected override bool ProcessKeyDownCore(System.Windows.Forms.KeyEventArgs e)
        {
            if (e.Control && e.Alt && e.KeyCode == System.Windows.Forms.Keys.E)
            {
                //this.DocumentView.Insert("€");
                return false;
            }
 
            return base.ProcessKeyDownCore(e);
        }

Regards,
Michael
0
Svett
Telerik team
answered on 19 Apr 2013, 08:48 AM
Hi Michael,

I am glad we sorted this out. Do not hesitate to contact back, if you have further issues with RadConrols for Winforms.

Greetings,
Svett
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Tags
RichTextBox (obsolete as of Q3 2014 SP1)
Asked by
Michael Hilgers
Top achievements
Rank 1
Answers by
Svett
Telerik team
Michael Hilgers
Top achievements
Rank 1
Share this question
or