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

localization menu

4 Answers 29 Views
MaskedEditBox
This is a migrated thread and some comments may be shown as answers.
Ricardo
Top achievements
Rank 1
Ricardo asked on 01 Apr 2019, 08:28 AM

Hellow everyone

When I right-click on RadMaskedEditBox, it will show me copy and paste, but it shows me English. How can I show it in a different language?

4 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 01 Apr 2019, 11:49 AM
Hi Ricardo,

It seems that this specific context menu cannot be localized. I have logged this issue on our Feedback Portal. You can track its progress, subscribe to status changes and add your comment to it here. I have also updated your Telerik Points.

To workaround this you can manually create the context menu:
public RadForm1()
{
    InitializeComponent();
    radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Standard;
    radMaskedEditBox1.Mask = "9999999999";
    radMaskedEditBox1.MaskedEditBoxElement.ContextMenuEnabled = true;
    radMaskedEditBox1.MaskedEditBoxElement.ContextMenu = BuildContextMenu();
}
private RadContextMenu BuildContextMenu()
{
    var contextMenu = new RadContextMenu();
 
 
    if (contextMenu == null)
    {
        contextMenu = new RadContextMenu();
    }
 
    if (contextMenu.Items.Count == 0)
    {
        RadMenuItem menuItem = new Telerik.WinControls.UI.RadMenuItem("Cut");
        menuItem.Name = "Cut";
        contextMenu.Items.Add(menuItem);
        menuItem.Click += new System.EventHandler(this.ContextMenuMenuItem_Click);
 
        menuItem = new Telerik.WinControls.UI.RadMenuItem("Test");
        menuItem.Name = "Copy";
        contextMenu.Items.Add(menuItem);
        menuItem.Click += new System.EventHandler(this.ContextMenuMenuItem_Click);
 
        menuItem = new Telerik.WinControls.UI.RadMenuItem("Paste");
        menuItem.Name = "Paste";
        contextMenu.Items.Add(menuItem);
        menuItem.Click += new System.EventHandler(this.ContextMenuMenuItem_Click);
 
        menuItem = new Telerik.WinControls.UI.RadMenuItem("Delete");
        menuItem.Name = "Delete";
        contextMenu.Items.Add(menuItem);
        menuItem.Click += new System.EventHandler(this.ContextMenuMenuItem_Click);
 
        menuItem = new Telerik.WinControls.UI.RadMenuItem("Select All");
        menuItem.Name = "Select All";
        contextMenu.Items.Add(menuItem);
        menuItem.Click += new System.EventHandler(this.ContextMenuMenuItem_Click);
    }
    return contextMenu;
}
void ContextMenuMenuItem_Click(object sender, EventArgs e)
{
    switch (((Telerik.WinControls.UI.RadMenuItem)(sender)).Name.ToUpper())
    {
        case "UNDO":
            //this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.;
            break;
        case "CUT":
            this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.Cut();
            break;
        case "COPY":
            this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.Copy();
            break;
        case "PASTE":
            this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.Paste();
            if (!this.radMaskedEditBox1.MaskedEditBoxElement.Provider.Validate(this.Text))
            {
                this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.TextBoxControl.Undo();
            }
 
            break;
        case "DELETE":
            this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.Clear();
            break;
        case "SELECT ALL":
            this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.SelectAll();
            break;
        default:
            break;
    }
}

Should you have any other questions do not hesitate to ask.
 
Regards,
Dimitar
Progress Telerik
Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Ricardo
Top achievements
Rank 1
answered on 02 Apr 2019, 08:38 AM

Hi Dimitar

Thanks for your reply, but it can't be here, is it because the programming language I use is VB.net? Can you provide a VB code sample again?

0
Accepted
Dimitar
Telerik team
answered on 02 Apr 2019, 08:43 AM
Hello Ricardo,

Here is the VB code:
Public Sub New()
    InitializeComponent()
    radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Standard
    radMaskedEditBox1.Mask = "9999999999"
    radMaskedEditBox1.MaskedEditBoxElement.ContextMenuEnabled = True
    radMaskedEditBox1.MaskedEditBoxElement.ContextMenu = BuildContextMenu()
End Sub
Private Function BuildContextMenu() As RadContextMenu
    Dim contextMenu = New RadContextMenu()
 
 
    If contextMenu Is Nothing Then
        contextMenu = New RadContextMenu()
    End If
 
    If contextMenu.Items.Count = 0 Then
        Dim menuItem As RadMenuItem = New Telerik.WinControls.UI.RadMenuItem("Cut")
        menuItem.Name = "Cut"
        contextMenu.Items.Add(menuItem)
        AddHandler menuItem.Click, AddressOf ContextMenuMenuItem_Click
 
        menuItem = New Telerik.WinControls.UI.RadMenuItem("Test")
        menuItem.Name = "Copy"
        contextMenu.Items.Add(menuItem)
        AddHandler menuItem.Click, AddressOf ContextMenuMenuItem_Click
 
        menuItem = New Telerik.WinControls.UI.RadMenuItem("Paste")
        menuItem.Name = "Paste"
        contextMenu.Items.Add(menuItem)
        AddHandler menuItem.Click, AddressOf ContextMenuMenuItem_Click
 
        menuItem = New Telerik.WinControls.UI.RadMenuItem("Delete")
        menuItem.Name = "Delete"
        contextMenu.Items.Add(menuItem)
        AddHandler menuItem.Click, AddressOf ContextMenuMenuItem_Click
 
        menuItem = New Telerik.WinControls.UI.RadMenuItem("Select All")
        menuItem.Name = "Select All"
        contextMenu.Items.Add(menuItem)
        AddHandler menuItem.Click, AddressOf ContextMenuMenuItem_Click
    End If
    Return contextMenu
End Function
Private Sub ContextMenuMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
    Select Case (DirectCast(sender, Telerik.WinControls.UI.RadMenuItem)).Name.ToUpper()
        Case "UNDO"
            'this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.;
        Case "CUT"
            Me.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.Cut()
        Case "COPY"
            Me.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.Copy()
        Case "PASTE"
            Me.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.Paste()
            If Not Me.radMaskedEditBox1.MaskedEditBoxElement.Provider.Validate(Me.Text) Then
                Me.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.TextBoxControl.Undo()
            End If
 
        Case "DELETE"
            Me.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.Clear()
        Case "SELECT ALL"
            Me.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem.SelectAll()
        Case Else
    End Select
End Sub

I hope this helps. 

Regards,
Dimitar
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.
0
Ricardo
Top achievements
Rank 1
answered on 02 Apr 2019, 10:40 AM

Hi Dimitar

Thank you very much for your help. It works very well

Best wishes to you!

Tags
MaskedEditBox
Asked by
Ricardo
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Ricardo
Top achievements
Rank 1
Share this question
or