indesign - How to detect right-click on script UI button? -
using adobe indesign's extendscript (javascript language), how can add onclick
function both left , right click events?
adding left-click event easy. how add right-click event?
[post answer update (much josh voights finding that)]
if interested, wanted use in such way apply handler button this, works perfectly:
whatbutton.addeventlistener("click", function(p){ if(!p.shiftkey){ if (p.button ==2) { alert("right click"); }else{ alert("left click"); } }else{ if (p.button ==2) { alert("shift right click"); }else{ alert("shift left click"); } }
here's code sample kahrel.plus.com/indesign/scriptui.html includes watching right click. credit @fabiantheblind in this stackoverflow answer.
var w =new window ("dialog"); var b = w.add ("button", undefined, "qwerty"); b.addeventlistener("click", function (k){whatsup (k)}); function whatsup (p) { if(p.button == 2){ $.writeln ("right-button clicked.") } if(p.shiftkey){ $.writeln ("shift key pressed.") } $.writeln ("x: "+ p.clientx); $.writeln ("y: "+ p.clienty); } w.show ();
Comments
Post a Comment