2 Replies Latest reply on Jun 14, 2013 8:21 AM by Alan_AEDScripts

    Pop up window at mouse pointer

    Alan_AEDScripts Level 2

      Hi there,  I am totally new to events, never really needed them so excuse my lack of knowledge on this. I am trying to pop up a window at the mouse pointer.

      The solution I have is clunky. So I pop up a window, maybe maximum size - make it's opacity zero, so the user can't see it. Then I set up a 'mousemove' listener

      on this large invisible window which triggers the next window to appear at the right position.

       

      So I have to move the mouse to pop up the window, I would rather a keyboard event to pop the window up, but there is no screenX, screenY property in the keyboard event object.

       

      Any pointers appreciated...  am I totally up the wrong path....?

      Many thanks.

      Alan.

       

      var w = new Window ("dialog");

                   w.preferredSize=[700,700];

                   w.addEventListener ("mousemove", function (m) {eventHandler(m)});

       

                                              function eventHandler (ev){

                                                        //b.text =  ("X: " + ev.screenX+"Y: " + ev.screenY);

                           

                                                        var w2= new Window ("dialog");

                            w2.location = [ev.screenX,ev.screenY];

                            w2.show();

                            w.close();

                                              }

       

                 

                                    w.show ();