StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Rob  
#1 Posted : Saturday, March 16, 2019 9:28:09 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 52
United States

Was thanked: 10 time(s) in 5 post(s)
Put this script inside the Global Actions > Mouse Events > Left Click Script to allow Alt+Drag to move window (which is not maximized).
FYI, the click event scripts do not interfere with input, so the Alt key down and release are still received by the window.

Note, this only works starting with version 0.2.9.2, prior versions only executed the click scripts on mouse up.

Code:
if(click.Down) {
    if((sp.GetKeyState(vk.LMENU) & 0x8000) && !sp.GetStoredBool("MoveWindowActive")) {
        if(!click.Window.Maximized) {
            sp.StoreBool("MoveWindowActive", true);
            sp.StoreHandle("MoveWindowHandle", click.Window.HWnd);
            sp.StorePoint("MoveWindowMouseStart", sp.GetCurrentMousePoint());
            sp.StorePoint("MoveWindowStart", click.Window.Location);
            sp.CreateTimer("MoveWindow", 20, 10, String.raw`
                                    var wnd = sp.WindowFromHandle(sp.GetStoredHandle("MoveWindowHandle"));
                                    if(sp.GetKeyState(vk.ESCAPE) & 0x8000) {
                                        wnd.Location = sp.GetStoredPoint("MoveWindowStart");
                                        sp.DeleteTimer("MoveWindow");
                                    }
                                    var startMousePt = sp.GetStoredPoint("MoveWindowMouseStart");
                                    var currMousePt = sp.GetCurrentMousePoint();
                                    var currWinPt = wnd.Location;
                                    if(sp.GetStoredBool("MoveWindowActive")) {
                                        wnd.Location = new Point(currWinPt.X + currMousePt.X - startMousePt.X, currWinPt.Y + currMousePt.Y - startMousePt.Y);
                                    }
                                    sp.StorePoint("MoveWindowMouseStart", currMousePt);
                                `);
        }
    }
} else {
    if(sp.GetStoredBool("MoveWindowActive")) 
    {
        sp.DeleteStoredHandle("MoveWindowHandle");
        sp.DeleteStoredBool("MoveWindowActive");
        sp.DeleteTimer("MoveWindow");
        sp.DeleteStoredPoint("MoveWindowMouseStart");
        sp.DeleteStoredPoint("MoveWindowStart");
    }
}

Edited by user Saturday, March 16, 2019 9:43:44 AM(UTC)  | Reason: Not specified

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.