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

NO KeyPress event in RadMaskedEditBox

7 Answers 211 Views
MaskedEditBox
This is a migrated thread and some comments may be shown as answers.
Sasha Monastirsky
Top achievements
Rank 1
Sasha Monastirsky asked on 06 Jan 2010, 04:14 PM
Hi,
I am using a RadMaskedEditBox control for win forms. The main task is to create a currency textbox and I am almost there. The problem is that when the user types a period as a decimal delimeter the control is not positioning the cursor after the period. So, in order to add this functionality I would need a KeyPress event fired on user's entry.

Please let me know how I can activate KeyPress ,KeyDown or KeyUp events or if you have already the currency text box with this functionality.

Appreciate your help.

Sasha

7 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 08 Jan 2010, 02:40 PM
Hello Sasha Monastirsky,

Thank you for the question.

Generally, RadMaskedEditBox support Currentcy mode. Please refer to our Examples application under  section Editors >> Masked Edit Box to see it in action.

As to the KeyPress event that does not fire, this is a known issue and it will be addressed in one of our next releases. For the time being, you can subscribe to the KeyPress event of the RadTextBoxItem contained in RadMaskedEditBox:
public Form1()
{
    InitializeComponent();
  
    this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.KeyPress += new KeyPressEventHandler(TextBoxItem_KeyPress);
}
  
void TextBoxItem_KeyPress(object sender, KeyPressEventArgs e)
{
  
}

I hope this helps. If you have additional questions, feel free to contact me.

Sincerely yours,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Sasha Monastirsky
Top achievements
Rank 1
answered on 08 Jan 2010, 04:15 PM

Thanks Nikolay,

After  I subscribed to the KeyPress event of the RadTextbox my new currency box is getting much better.

For the Mask property I am using "c4"

RadMaskedEditBox1.TextAlign = HorizontalAlignment.Right

RadMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Numeric

RadMaskedEditBox1.Mask = "c4"

Is there any way to not display a $ sign but keep the currency format as it is?
Mask "f" gives a very close solution but doesn't place comas in the formatted string (e.g 888,454,220.000).

Thanks Sasha

0
Nikolay
Telerik team
answered on 08 Jan 2010, 04:26 PM
Hello Sasha Monastirsky,

RadMaskedEditBox does not support placing thousands separators in the formatted strings. However, RadSpinEditor is the perfect control for your needs. You just need to set the following properties:
radSpinEditor1.ThousandsSeparator = True
radSpinEditor1.DecimalPlaces = 3
radSpinEditor1.Maximum = 1000000000
radSpinEditor1.ShowUpDownButtons = False
radSpinEditor1.TextAlignment = HorizontalAlignment.Right

I hope this helps. If you have additional questions, feel free to contact me.

Best wishes,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Sasha Monastirsky
Top achievements
Rank 1
answered on 08 Jan 2010, 04:49 PM

Nikolay,

I am using your RadMaskedEditBox and I am setting the Mask property to "c4" and this will produce 4 decimals.

RadMaskedEditBox1.TextAlign = HorizontalAlignment.Right

RadMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Numeric

RadMaskedEditBox1.Mask = "c4"

Is there a way to remove a $ sign?

Thank,

Sasha


0
Nikolay
Telerik team
answered on 11 Jan 2010, 01:03 PM
Hi Sasha Monastirsky,

Actually, your requirements suit better to the "n3" Mask. This mask has everything that you require to format your number. Just set the following properties:
radMaskedEditBox7.TextAlign = HorizontalAlignment.Right;
radMaskedEditBox7.Mask = "n3";
radMaskedEditBox7.MaskType = MaskType.Numeric;

In this case you do not need the Currency mask type, since it puts a "&" sign in front of the currency value and it does not support thousands separators.

I hope this helps. If you have additional questions, feel free to contact me.

Regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Sasha Monastirsky
Top achievements
Rank 1
answered on 11 Jan 2010, 04:38 PM
Hi Nikolay,
Thanks for your help.
The mask "n3" is what we need, but while I was testing the control I found that
if you have a number with the 0 before decimal point (1230.00) and you'll have to insert a number in between 1,2 or 3 it will always place it after 0 before decimal (12301.00).

Please let me know if this is a bug, and if this is, an approximate time of the new release with the fix.
Thanks,

Sasha

0
Nikolay
Telerik team
answered on 15 Jan 2010, 08:41 AM
Hello Sasha Monastirsky,

We will do our best to address the described issue in Q1 2010. For the time being, you can use our RadSpinEditor as it is shown in one of my previous replies.

Regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
MaskedEditBox
Asked by
Sasha Monastirsky
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Sasha Monastirsky
Top achievements
Rank 1
Share this question
or