Mouse click position is off

1 Answer 82 Views
TextBox TextBoxControl
Willy
Top achievements
Rank 2
Iron
Iron
Willy asked on 13 May 2022, 05:50 PM

Hello, I am having a bit of a weird issue. It seems the mouse down event / context menu only fires when I click the the border line of the control but not the inside of the control. When I click the inside of the control I get the default windows right click menu. Is there a way to fix this? 

 Private Sub txtHomePath_MouseDown(sender As Object, e As MouseEventArgs) Handles txtHomePath.MouseDown
        If e.Button = MouseButtons.Right Then
            Dim c As New RadDropDownMenu
            c.BeginInit()
            c.ThemeName = Me.ThemeName
            Dim item As New RadMenuItem("Delete Folder") With {.Image = My.Resources.folder_delete_fatcow.GetThumbnailImage(16, 16, Nothing, Nothing)}
            AddHandler item.Click, AddressOf DeleteFolder
            c.Items.Add(item)
            c.EndInit()
            c.Show(Control.MousePosition)
      End If

    End Sub

 

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 16 May 2022, 09:15 AM
Hello, Bill,   

Please have in mind that RadTextBox internally hosts the standard MS TextBox. That is why you are observing the default context menu when right-clicking the RadTextBox control. The following code snippet demonstrates how to eliminate the default context menu: 
Me.RadTextBox1.TextBoxElement.TextBoxItem.HostedControl.ContextMenuStrip = New ContextMenuStrip()
If you want to assign a context menu for RadTextBox, feel free to use the suggested approach in the following help article:
https://docs.telerik.com/devtools/winforms/controls/menus/contextmenu/assign-radcontextmenu-to-telerik-and-non-telerik-controls 

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
TextBox TextBoxControl
Asked by
Willy
Top achievements
Rank 2
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or