NO KeyPress event in RadMaskedEditBox

8 posts, 0 answers
  1. Sasha Monastirsky
    Sasha Monastirsky avatar
    4 posts
    Member since:
    Jan 2010

    Posted 06 Jan 2010 Link to this post

    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
  2. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 08 Jan 2010 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Sasha Monastirsky
    Sasha Monastirsky avatar
    4 posts
    Member since:
    Jan 2010

    Posted 08 Jan 2010 Link to this post

    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

  5. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 08 Jan 2010 Link to this post

    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.
  6. Sasha Monastirsky
    Sasha Monastirsky avatar
    4 posts
    Member since:
    Jan 2010

    Posted 08 Jan 2010 Link to this post

    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


  7. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 11 Jan 2010 Link to this post

    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.
  8. Sasha Monastirsky
    Sasha Monastirsky avatar
    4 posts
    Member since:
    Jan 2010

    Posted 11 Jan 2010 Link to this post

    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

  9. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 15 Jan 2010 Link to this post

    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.
Back to Top
UI for WinForms is Visual Studio 2017 Ready