Answered
Opening window on mouse.
Hello!
I am attempting to write a script that opens a dialog window. How would I be able to have the window open at the current mouse position?
Hello!
I am attempting to write a script that opens a dialog window. How would I be able to have the window open at the current mouse position?
var cursor = (getXY());
var w = new Window("dialog", 'Test');
w.preferredSize = [200, 200];
w.location = [cursor[0], cursor[1]]
w.show();
function getXY() {
var w = new Window("dialog {alignChildren: ['fill','fill'], margins: 0, opacity : 0.01}"),
g = w.add("button"),
X, Y;
w.preferredSize = [$.screens[0].right, $.screens[0].bottom]
g.addEventListener('mouseover', handler)
function handler(evt) { w.close(); X = evt.screenX, Y = evt.screenY }
w.show();
return [X, Y]
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.