Neutron.ahk
Neutron.ahk copied to clipboard
how to disable right click context menu?
Is there a way to disable right click context menu in Neutron? I noticed it has some disabled_shortcuts array but not sure how to use that or if that's relevant in this case?
You should be able to register the appropriate event handler on the body element and direct it to call an AHK function
when you say body element, do you mean javascript? I'm trying to avoid javascript/html methods and do it using AHK or Neutron WM_whatever events. I tried adding
WM_RBUTTONDOWN := 0x204 , WM_NCRBUTTONDOWN :=0xA4 , WM_CONTEXTMENU := 0x7B
0: {
this.WM_CONTEXTMENU: true
},
1: {
this.WM_BUTTONDOWN: true
},
but nothing happens and I'm not even sure how to test these events. I don't know what pressing f5 does in IE as I normally use Firefox but it's not triggering anything in the message box:
; Block disabled key combinations
msgbox % this.modifiers wParam if (this.disabled_shortcuts[this.modifiers, wParam]) msgbox disabled return 0
RButton:: if !WinActive("file.ahk"){ SendInput ^{RButton} } Return
Or u can do it with js
$(document).ready(function() {
$("html").on("contextmenu", function(e) {
return false;
});
});
here:
#include %A_ScriptDir%/lib/Neutron.ahk
#NoEnv
nGUI := new NeutronWindow("index.html")
nGUI.Show("w1390 h470")
winSetTitle, myTitle
Roff = 0 ;initiate Rbutton off as disabled
settimer, mousePOSCheck, 10 ;settimer to label that checks mouse pos
return
mousePOSCheck:
mousegetpos,,,mID
wingetTitle, mTitle, % "ahk_ID" mID
If (mTitle = "myTitle") ; is app under mouse position? (quotes are necessary)
Roff = 1 ; if yes rbutton disabled
else
Roff = 0 ; if no rbutton enabled
return
#if Roff = 1 ; context-sensitive hotkey below.
rbutton:: ; rbutton will not perform mousedown event while off = 1
send {rbutton up}
return
#if