|
Rank: Newbie Groups: Member
Joined: 9/28/2015 Posts: 1
|
Hello, I have a problem with customizing a hot key. I create an application with a EO.WebControl (EO.Total 2015.2.65.0) and a TextBox (it can be a Button, a ListBox...what ever you want)
Code: Visual Basic.NET
Imports EO.WebBrowser
Public Class Form1
Private EscCmdId As Integer
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
WebView1.Url = "http://www.essentialobjects.com/products/webbrowser/default.aspx"
EscCmdId = CommandIds.RegisterUserCommand("esc_cmd")
WebView1.Shortcuts = New Shortcut() {New Shortcut(EscCmdId, KeyCode.Escape, False, False, False)}
End Sub
Private Sub WebView1_Command(sender As Object, e As EO.WebBrowser.CommandEventArgs) Handles WebView1.Command
If e.CommandId = EscCmdId Then MessageBox.Show("Escape")
End Sub
End Class
If the TextBox has the focus and i press on Escape, the message appears. At the opposite, if the EO.WebControl has the focus (i select some text in the web page for example) and i press on Escape, the message doesn't appear. Is it a bug or do i miss something ? Thank you very much.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,275
|
Hi,
We have confirmed this to be a bug. We will fix it in our next build.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 3/17/2016 Posts: 12
|
Hello fred, you example helped me lot but can you please post this code again with Ctrl+V instead of Esc because i have searched many many time to fine command for Ctrl+V but i failed, as in you example when we will press Esc button then message box shows so i just want to replace Ctrl+V instead of Esc, so i want that when we press Ctrl+V then message box show us message, thanks in advance Admin if you can post then please help me for this
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,275
|
joinyasin wrote:Hello fred, you example helped me lot but can you please post this code again with Ctrl+V instead of Esc because i have searched many many time to fine command for Ctrl+V but i failed, as in you example when we will press Esc button then message box shows so i just want to replace Ctrl+V instead of Esc, so i want that when we press Ctrl+V then message box show us message, thanks in advance Admin if you can post then please help me for this Hi, You will not be able to replace the default shortcut behaviors of the browser through WebView.Shortcut. The shortcuts occurs in the browser engine and are passed to the .NET side but this does not cancel whatever the browser engine will do with the shortcut. In another words, the shortcuts takes two branches --- one continue in the browser engine and the other is passed to your code. If the browser engine does not take any action to the shortcuts, you can take actions in your code. If the browser engine already takes action, the only way to cancel the shortcut is inside the browser engine. This usually means you need to handle the keyboard events and cancel it in the page through JavaScript. It can not be canceled/replaced in .NET code. Thanks!
|
|