Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Window placement
#12
was just messing around made this
puts all 9 different positions in 1 function and lets you choose at run time where to place the window. Uses a list dialog.


Function MoveActiveWindow
Code:
Copy      Help
int iSel=ListDialog("Top Left[]Top Center[]Top Right[]Left Center[]Center[]Right Center[]Bottom Left[]Bottom Center[]Bottom Right" "Select a screen position to move the active window" "Choose a Position")
sub.MoveWindowToScreenPosition(iSel-1)

#sub MoveWindowToScreenPosition
function position
int x y
sel position
,case 0;;Top Left
,x=1
,y=1
,case 1;;Top Center
,x=0
,y=1
,case 2;;Top Right
,x=-1
,y=1    
,case 3;;Left Center
,x=1
,y=0
,case 4;;Center
,x=0
,y=0
,case 5;;Right Center
,x=-1
,y=0
,case 6;;Bottom Left
,x=1
,y=-1
,case 7;;Bottom Center
,x=0
,y=-1
,case 8;;;Bottom Right
,x=-1
,y=-1    
,case else
,ret

int hwnd=RealGetNextWindow(0)
RECT r    
r.left=x; r.top=y
AdjustWindowPos hwnd &r 3
act hwnd
if you would want to run this specifically from qm i would recommend putting a trigger on it
something like this

Function MoveActiveWindow
Trigger CAF8     Help - how to add the trigger to the macro
Code:
Copy      Help
int iSel=ListDialog("Top Left[]Top Center[]Top Right[]Left Center[]Center[]Right Center[]Bottom Left[]Bottom Center[]Bottom Right" "Select a screen position to move the active window" "Choose a Position")
sub.MoveWindowToScreenPosition(iSel-1)

#sub MoveWindowToScreenPosition
function position
int x y
sel position
,case 0;;Top Left
,x=1
,y=1
,case 1;;Top Center
,x=0
,y=1
,case 2;;Top Right
,x=-1
,y=1    
,case 3;;Left Center
,x=1
,y=0
,case 4;;Center
,x=0
,y=0
,case 5;;Right Center
,x=-1
,y=0
,case 6;;Bottom Left
,x=1
,y=-1
,case 7;;Bottom Center
,x=0
,y=-1
,case 8;;;Bottom Right
,x=-1
,y=-1    
,case else
,ret

int hwnd=RealGetNextWindow(0)
RECT r    
r.left=x; r.top=y
AdjustWindowPos hwnd &r 3
act hwnd


Messages In This Thread
Window placement - by InterestedNewbie - 09-28-2018, 04:41 PM
RE: Window placement - by Kevin - 09-28-2018, 07:07 PM
RE: Window placement - by InterestedNewbie - 09-29-2018, 12:46 AM
RE: Window placement - by Kevin - 09-29-2018, 01:27 AM
RE: Window placement - by InterestedNewbie - 09-29-2018, 02:35 AM
RE: Window placement - by Kevin - 09-29-2018, 02:37 PM
RE: Window placement - by InterestedNewbie - 09-29-2018, 07:43 PM
RE: Window placement - by Kevin - 09-29-2018, 08:09 PM
RE: Window placement - by InterestedNewbie - 09-30-2018, 03:12 PM
RE: Window placement - by Kevin - 09-30-2018, 04:08 PM
RE: Window placement - by InterestedNewbie - 09-30-2018, 06:36 PM
RE: Window placement - by Kevin - 10-01-2018, 01:55 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)