 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Yek-Toho-Tua Guest
|
Posted: Thu Jul 22, 2004 2:11 pm Post subject: MsgBox affecting mouse co-ordinates??! |
|
|
Firstly, greeeat program! i can't beleive the power it weilds over windoze!
ok, i hope i can make this next bit clear! bit of a noob...
so, I'm customizing my own version of the various (very good) pop-up middle mouse menu scripts in the forums, and came across this strange "bug". Here is the code:
| Code: |
Menu, X, Add, Y
Menu, Pop, Add, A, :X
MButton::
CoordMode, Mouse, Screen
CoordMode, ToolTip, Screen
MouseGetPos, Mx, My
Msgbox Pop up menu was clicked to occur at %Mx%, %My%
Menu, Pop, Show
Return
Y:
Sleep 1000
;Note!!! Comment the next line out to see the bug. Leave it in to see normal behaviour.
Msgbox Mouse was clicked at %Mx%, %My%, moving back there after you click OK
MouseClick, Left, %Mx%, %My%, 1, 20
ToolTip, MOUSE WAS CLICKED HERE
SetTimer, RemoveToolTip, 5000
Return
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
|
If you run it and then click the middle mouse button somewhere on the screen, then press space to by pass 1st msgbox, then you'll see a useless menu come up. A > Y
Select the "Y" item, **move the mouse** to click the next dialog box and the mouse will move back to original spot of the middle click and show a tool tip.
all ok.
now do the script with the 2nd msgbox line commented out, ie
| Code: |
......
Y:
Sleep 1000
;Note!!! Comment the next line out to see the bug. Leave it in to see normal behaviour.
; !!!!! COMMENTED OUT !!!!!! Msgbox Mouse was clicked at %Mx%, %My%, moving back there after you click OK
MouseClick, Left, %Mx%, %My%, 1, 20
....
|
When you run this script, after you click the Y menu, don't touch the mouse- the mouse will jumps to 0,0!!!
huh?
Please help! I've tested this on 2K SP4 and XP SP1... i hope its not sumthing stupid i'm doing...
2nd "bug" is only seen when task bar is moved to left hand side of the screen (ie virtical).
Task Bar
v
v
------------------
|+| |
| | |
| | |
| | |
| | |
------------------
its best seen if you make it 1 inch wide too. when that is done, the first version of this code (the one that works) shows the ToolTip offset to the right by about the same width as the task bar! this "bug" is much less important - just thought i'd mention it...
thanks for a great program and this forum!!
[/list] |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Fri Jul 23, 2004 4:10 am Post subject: |
|
|
| Thanks for reporting this, I'm going to try to figure out what's going on. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Fri Jul 23, 2004 2:38 pm Post subject: |
|
|
The problem is two-fold:
1) You switch the mouse to screen coordinates in the MButton subroutine. However, the menu subroutine will not obey this setting because it is different thread. Thus, you should either change to screen coordinates globally (by using "CoordMode, Mouse" in the top section of the script) or also change to screen coordinates in the Menu subroutine prior to the MouseClick (probably the best option).
2) As a result of #1, the MouseClick will use relative coordinates, not screen coordinates. Due to a quirk of how popup menus work, the script's own main window (which is usually hidden and minimized) is the foreground window and thus the click will occur relative to it. But because a minimized window has bizarre position and size, the click would occur off-screen, so instead the program falls back to clicking at 0,0.
The above has been resolved by reverting to screen coordinates whenever the active window is in a minimized state (seems better than clicking at 0,0). However, since this issue is so obscure I don't think I'll mention it in the change log (it would likely confuse or be meaningless to 99% of people reading it).
| Quote: | | 2nd "bug" is only seen when task bar is moved to left hand side of the screen (ie virtical) ... the ToolTip offset to the right by about the same width as the task bar! |
I can't reproduce that on my XP system, nor do I see any reason for it in the code. Can you double check? |
|
| Back to top |
|
 |
Yek-Toho-Tua
Joined: 23 Jul 2004 Posts: 6
|
Posted: Mon Jul 26, 2004 4:10 pm Post subject: |
|
|
interesting! Your analysis and explainations are very good all over this site. in the above, you've helped me write better scripts as well...
| Quote: |
or also change to screen coordinates in the Menu subroutine prior to the MouseClick (probably the best option).
|
... so that is a bonus. I will have to read up more about threads in the help so i can understand better what settings affect what etc. yes, the bug was very obsure, but i've got a nasty knack at finding obscure stuff
regarding the Virtical Task Bar, i will reload my boxes with *pure* XP and test (i use ghost so its no sweat at all). i suspect its somthing to do with some OS mod i may have done because a bunch of programs are having problems with the taskbar being there.... i'll post again once i nail it down a bit better. _________________ float o=0.075,h=1.5,T,r,O,l,I;int _,L=80,s=3200;main(){for(;s%L||
(h-=o,T= -2),s;4 -(r=O*O)<(l=I*I)|++ _==L&&write(1,(--s%L?_<L?--_
%6:6:7)+"World! \n",1)&&(O=I=l=_=r=0,T+=o /2))O=I*2*O+h,I=l+T-r;} |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|