Shoutbox

[library] MouseOver - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [library] MouseOver (/showthread.php?tid=72468)

[library] MouseOver by effection on 03-08-2007 at 10:57 PM

Taken from my WLMTunes script, allows you to set up mouse event regions within a window.

Messy code, but it gets the job done ;)

Useage:
1) copy the "mouse.js" file to your script directory.
2) copy in the timer handlers to your OnEvent_Timer as shown in the example  below.
3) register the window that has to be active for the event to be called[if it is null the event will be triggered no matter what the top window is], a mouse event name, rectangular area with window and hover time of the mouse.

code:
//example
function testing(){
        mouse = new MouseEvent();
        var window = 0;
        mouse.registerMouseEvent(window, "HelloWorld",10, 10, 40, 40, 1000);
}
function OnHelloWorldEvent_MouseOver(name, curX, curY){
        Debug.trace("Mouse is in the area! X: "+curX+" Y: "+curY);
}
function OnHelloWorldEvent_MouseOff(name, curX, curY){
        Debug.trace("Mouse has left the area! X: "+curX+" Y: "+curY);
}

function OnEvent_Timer(ID){
        var mouse = new MouseEvent();
        var string = ID.substring(0, ID.indexOf("_"));
        var name = ID.substring(ID.indexOf("_")+1);
        if(string == "mouseEvent"){
                ID = "mouseEvent";
        }
        switch(ID){
                case "mouse_update":
                        mouse.CheckEvents();
                        MsgPlus.AddTimer("mouse_update", 100);
                break;
       
                case "mouseEvent":
                        mouseEvents[name][5] = 2;
                break;
        }
}