topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday March 19, 2024, 4:43 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: IDEA: Move dialog boxes to the center of the (correct) monitor  (Read 20702 times)

David.P

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 206
  • Ergonomics Junkie
    • View Profile
    • Donate to Member
... or where the parent application is (make that an option).

This would be great for multi-monitor-systems where dialog boxes for some reason can always pop up on the wrong monitor.

DialogMove does a good job in this sense, already (see discussion here) -- however DialogMove can't be restricted in order to not additionaly move all dialogs under the mouse pointer (because the latter actually is what it is SUPPOSED to do).

Therefore it would be great to have a little tool that could move dialogs similar as DialogMove does, but ONLY when dialogs pop up on the wrong monitor (or when they come up on the correct monitor, but not centered).

Recapitulating: The IDEA is, popups and dialogs should only be moved (to the center of the monitor where the mouse pointer is OR where the parent application is, possibly make that an option) when they are either a) on the wrong monitor or b) on the correct monitor, but not centered (on the monitor).

Thanks HEAPS already,
Cheers David.P

« Last Edit: April 07, 2011, 01:03 AM by David.P, Reason: defined \"centered\" »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the monitor where the mouse is
« Reply #1 on: April 06, 2011, 06:50 PM »
Just to clarify, by "centered" you mean at the middle of the screen, not "centered" on the mouse like DialogMove does, right?

David.P

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 206
  • Ergonomics Junkie
    • View Profile
    • Donate to Member
IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #2 on: April 07, 2011, 12:54 AM »
Exactly jgpaiva (have edited my top post respectively in order to clarifiy).

Regards David
« Last Edit: April 07, 2011, 01:04 AM by David.P »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #3 on: April 07, 2011, 06:06 AM »
I have just modified DialogMove's code to do what you asked.
I'm not 100% sure this will work, as I can't test it right now since I don't have a Windows machine with 2 screens.
You will need to install autohotkey to run it.

At least this can be a good starting point for anyone who might want to pick this up.
« Last Edit: April 14, 2011, 03:34 AM by jgpaiva, Reason: updated file with changes posted in the thread »

David.P

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 206
  • Ergonomics Junkie
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #4 on: April 07, 2011, 07:19 AM »
Great, jgpaiva -- thank you very much!

So far, the modified version seems to work almost perfect.

There's only one "phenomenon": If the mouse pointer already is in the very area where a window WILL popup, then that window will not get centered (this happens on the same monitor, therefore should be present with single monitor systems also).

Only if the mouse pointer is moved outside this area (which the popup/dialog will be covering afterwards) BEFORE the window actually comes up, then the window will get centered.

Isn't that a little strange...?  :-[
« Last Edit: April 07, 2011, 07:20 AM by David.P, Reason: typo »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #5 on: April 07, 2011, 08:40 AM »
Actually, that was on purpose :) It doesn't move a dialog if it is already below the mouse.
If you wish to change it, just delete the following lines (right after "move window"):

 CoordMode,Mouse,Relative
   MouseGetPos, MouseX, MouseY, MouseWin,
   If (MouseX > - WinBorder)
     If (MouseX < WinWidth + WinBorder)
       If (MouseY > - WinBorder)
         If (MouseY < WinHeight + WinBorder)
           return  

I'm not sure if this won't create other unexpected effects, though :)

David.P

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 206
  • Ergonomics Junkie
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #6 on: April 07, 2011, 09:03 AM »
Actually, that was on purpose :)

;D I see!

Works perfect! Now FINALLY after all these years of shoving those eBay "Enlarge Image" Popups in the middle of the screen manually, they do so automatically! :Thmbsup:

(Of course, the same applies to lots of other popup windows and dialogs).

Thanks -- I'll donate!

Cheers David

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #7 on: April 07, 2011, 11:17 AM »
 :D Glad to know it works for you!

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #8 on: April 07, 2011, 11:44 AM »
Of course, the same applies to lots of other popup windows and dialogs
Take a look at the Include and Exclude subroutines in the original script.

If you wanted to include or exclude certain dialog boxes from going to the center of the proper screen, you could probably do that.  (I don't have a dual monitor setup so I'm not going to look into the details.)

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #9 on: April 07, 2011, 12:27 PM »
Of course, the same applies to lots of other popup windows and dialogs
Take a look at the Include and Exclude subroutines in the original script.

If you wanted to include or exclude certain dialog boxes from going to the center of the proper screen, you could probably do that.  (I don't have a dual monitor setup so I'm not going to look into the details.)
Actually, I think David is glad that this modification of DialogMove works for all windows ;)

David.P

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 206
  • Ergonomics Junkie
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #10 on: April 07, 2011, 12:32 PM »
Yep  8)

David.P

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 206
  • Ergonomics Junkie
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #11 on: April 13, 2011, 03:27 AM »
Still very happy with this variation of DialogMove.

Only one question: is there a (simple) way to prevent movement of things that are no "proper" windows (e.g. with title bars)?

At the moment, DialogMove even moves floating (tray) notifications, context menus and even the start menu (to the center of the screen).

I'd however really only need "regular" popup windows and program dialogs to be moved. Everything else should not be touched.

Is there a way to do that, i.e. to exclude things that have no title bar from being touched by DialogMove?

Thanks heaps
David

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #12 on: April 13, 2011, 07:01 AM »
Get a copy of Window Spy from the Autohotkey site.  It will give you the ahk_class of any window you hover the mouse over, including the kind of not "proper" windows you are talking about.

You can then use the ahk_class name in the include or exclude list of DialogMove.

David.P

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 206
  • Ergonomics Junkie
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #13 on: April 13, 2011, 07:10 AM »
I know -- but I'd rather not having to maintain an ever growing black list... Instead, I'd very much like to tell the program: "ONLY touch things that have a title bar".

Can that be done?

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #14 on: April 13, 2011, 08:04 AM »
dunno, but you can get clever with the two size filters...

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #15 on: April 13, 2011, 05:15 PM »
I know -- but I'd rather not having to maintain an ever growing black list... Instead, I'd very much like to tell the program: "ONLY touch things that have a title bar".

Can that be done?

You can experiment with the spy. I just messed with it a bit.  Seems like non title bar windows should return blank for WinGetTitle function.  If WinGetTitle on the active window returns blank, it's not one you want etc..

Although the spy did pick up the title from this window:

http://www.favessoft.com/reopen.html

you can see it says "ReOpen" in what would be the caption bar, even though it's not the ordinary popup window.
« Last Edit: April 13, 2011, 05:17 PM by MilesAhead »

David.P

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 206
  • Ergonomics Junkie
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #16 on: April 14, 2011, 01:17 AM »
Yeah, but how can I insert "Blank" or "nil" into DialogMove's preferences then?

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #17 on: April 14, 2011, 01:42 AM »
Yeah, but how can I insert "Blank" or "nil" into DialogMove's preferences then?

I haven't looked at Dialog Move code since I don't have multiple monitors. If I can't try it out myself it's kind of a dead end.

nudone

  • Cody's Creator
  • Columnist
  • Joined in 2005
  • ***
  • Posts: 4,119
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #18 on: April 14, 2011, 02:18 AM »
Yeah, but how can I insert "Blank" or "nil" into DialogMove's preferences then?

I haven't looked at Dialog Move code since I don't have multiple monitors. If I can't try it out myself it's kind of a dead end.

Just a note: dialogmove works on any monitor, single or multi setup. The original purpose was to work on a single large monitor; it was then tweaked for multi screens.

I even find it useful on a tiny netbook screen.

David.P

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 206
  • Ergonomics Junkie
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #19 on: April 14, 2011, 02:46 AM »
It's the same on single monitors: for example the start menu gets moved to the center in my case (admittedly at least partially caused because I wanted DialogMove to center windows even when the mouse is already over them, see further up the thread).

I guess that probably around these parts in DialogMove something (?) would have to be changed in order not to detect windows without title bars:

   WinGetTitle,WinTitle,ahk_id %ActiveWindow%
   WinClass=ahk_class%A_space%%Winclass%
   If NotDetectableWindow(WinTitle,WinClass)
     return

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #20 on: April 14, 2011, 03:17 AM »
Hi David!

Jut modify that code to:

   WinGetTitle,WinTitle,ahk_id %ActiveWindow%
   WinClass=ahk_class%A_space%%Winclass%
   if WinTitle=""
      return
   If NotDetectableWindow(WinTitle,WinClass)
     return

David.P

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 206
  • Ergonomics Junkie
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #21 on: April 14, 2011, 03:30 AM »
"Grea-heat", jgpaiva as usual! Afterwards, things can look quite simple sometimes   :-[

Thanks very much,
Cheers David

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #22 on: April 14, 2011, 03:34 AM »
"Grea-heat", jgpaiva as usual! Afterwards, things can look quite simple sometimes   :-[

Thanks very much,
Cheers David
Great! I have updated the modified dialogMove I posted in this thread with the changes ;)

David.P

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 206
  • Ergonomics Junkie
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #23 on: April 14, 2011, 03:36 AM »
Thanks!

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: IDEA: Move dialog boxes to the center of the (correct) monitor
« Reply #24 on: April 14, 2011, 08:54 PM »
Yeah, but how can I insert "Blank" or "nil" into DialogMove's preferences then?

I haven't looked at Dialog Move code since I don't have multiple monitors. If I can't try it out myself it's kind of a dead end.

Just a note: dialogmove works on any monitor, single or multi setup. The original purpose was to work on a single large monitor; it was then tweaked for multi screens.

I even find it useful on a tiny netbook screen.

I believe.  All I'm saying is the OP wants a function for multiple monitors and it seems futile to get into it if I don't have a MM set up.  Simulation ain't always the same as running 2 real physical devices. If I can't test it myself I don't want to code it.  Unless I was somebody's employee then I guess I'd haveta'. :)