Unplanned
Last Updated: 26 Apr 2019 06:12 by ADMIN
Fabrice
Created on: 26 Apr 2019 06:06
Category: Editors
Type: Bug Report
1
RadMaskedEditBox: incorrect cursor position with InsertKeyMode.Overwrite and Standard mask

Use the following code snippet:

            this.radMaskedEditBox1.Mask = "99/99/99/99/99/99";
            this.radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Standard;
            this.radMaskedEditBox1.PromptChar = ' ';
            ((StandartMaskTextBoxProvider)this.radMaskedEditBox1.MaskedEditBoxElement.Provider).TryGetStandardProvider().InsertKeyMode = InsertKeyMode.Overwrite;

When the cursor is just before the last "/", if you enter a number, then the cursor does not move after this last "/". Then entering another digit overwrites the last digit typed.

Attached Files:
1 comment
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 26 Apr 2019 06:12
Hello, Fabrice,    

Thank you for reporting this.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to use the already found KeyPress event handling as follows: 

private void radMaskedEditBox1_KeyPress(object sender, KeyPressEventArgs e)
{
    if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]"))
        return;
    if (radMaskedEditBox1.SelectionStart.Equals(radMaskedEditBox1.Mask.LastIndexOf('/')))
        radMaskedEditBox1.SelectionStart++;
}


Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.