ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > JGPaiva's GridMove and Ahk Tools

Trying to make WindowWidth center on cursor

<< < (2/2)

jgpaiva:
Sorry, bad math on my part. This line:

--- ---If (GridTop + 0.5 * WinHeight > MonitorBottom)
Should be like this:

--- ---If (GridTop + 1.5 * WinHeight > MonitorBottom)
Also, do the same on every other line similar to that one (all those that have the comparisons).

jgpaiva:
I'm sorry, I was probably sleeping when I did the code above.

This version should fix all the problems:

--- ---  If GridTop = WindowHeight
  {
    MonitorBottom := GetMonitorBottom(MouseX, MouseY)
    MonitorTop := GetMonitorTop(MouseX, MouseY)
    GridTop := MouseY - 0.5 * WinHeight
    If (GridTop + WinHeight > MonitorBottom)
      GridTop := MonitorBottom - WinHeight
    If (GridTop < MonitorTop)
      GridTop := MonitorTop
    GridBottom := GridTop + WinHeight
  }
   
  If GridLeft = WindowWidth
  {
    MonitorRight := GetMonitorRight(MouseX, MouseY)
    MonitorLeft := GetMonitorLeft(MouseX, MouseY)
    GridLeft := MouseX - 0.5 * WinWidth
    If (GridLeft + WinWidth > MonitorRight)
      GridLeft := MonitorRight - WinWidth
    If (GridLeft < MonitorLeft)
      GridLeft := MonitorLeft
    GridRight := GridLeft + WinWidth       
  }

Navigation

[0] Message Index

[*] Previous page

Go to full version