Created
April 25, 2020 20:15
-
-
Save PBfordev/b1c3822e62bc915b6d44f45e6c352cb1 to your computer and use it in GitHub Desktop.
Needed for js-to-wx.cpp gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Test</title> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
<h1>Title H1</h1> | |
<p>Right click or double click inside the document to trigger a response inside wxWidgets C++ code.</p> | |
<script> | |
const wxWebViewProtocol = 'wxwebview://'; | |
function onDocumentContextMenu(evt) | |
{ | |
evt.preventDefault(); | |
var command = wxWebViewProtocol + 'document_contextMenu/params?'+ | |
'clientX=' + evt.clientX + | |
'&clientY=' + evt.clientY; | |
window.location.assign(command); | |
console.log(command); | |
} | |
function onDocumentDblClick(evt) | |
{ | |
var command = wxWebViewProtocol + 'document_dblClick/params?'+ | |
'clientX=' + evt.clientX + | |
'&clientY=' + evt.clientY; | |
window.location.assign(command); | |
console.log(command); | |
} | |
document.addEventListener('contextmenu', onDocumentContextMenu); | |
document.addEventListener('dblclick', onDocumentDblClick); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The C++ gist is here
https://gist.github.com/PBfordev/94ed68ca1a49b318813f7f1a4cc5adeb