Jump to content

mouse over


Recommended Posts

is there a way so i can check if my mouse in over the picture??

like a function that returns 1 if it is above it and 0 if it isn't

thanks

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

Yes, but the image like a control(GUI), browser?

<{POST_SNAPBACK}>

you could just have a loop check mouse coords vs pic coords, and perform statements when the two coincide...check out MouseGetPos(),if the position of the image isn't static, you may want to make use of ControlGetPos() to specify the area you want for the mouse over...with those two functions and a loop w/ condition check, you should have no prob.
Link to comment
Share on other sites

so you mean like:

if $mouseposX  > ($picX-1) and < ($picX+picwidht+1) then
 if $mouseposY  > ($picY-1) and < ($picY+picheight+1) then
   return 1
 endif
endif
*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

so you mean like:

if $mouseposX  > ($picX-1) and < ($picX+picwidht+1) then
 if $mouseposY  > ($picY-1) and < ($picY+picheight+1) then
   return 1
 endif
endif

<{POST_SNAPBACK}>

definitely on the right track (except the statement to the right of your and statement isn't one that would be evaluated the way you want it to). try something like this...

$pos = GetMousePos()
$cpos = ControlGetPos("MyWindow","",1111)
if $pos[0] > $cpos[0] and $pos[0] < $cpos[0] + $cpos[2] then
if $pos[1] > $cpos[1] and $pos[1] < $cpos[1] + $cpos[3] then
      MouseOverFuncNameHere()
EndIf
EndIf

***edit***

i hadn't initially given the ControlGetPos() the parameters it wanted. the only real changes you would have to make to use that codebit are the arguments for ControlGetPos() and the function name to call when the mouse is over the pic.

Edited by cameronsdad
Link to comment
Share on other sites

is there a way so i can check if my mouse in over the picture??

like a function that returns 1 if it is above it and 0 if it isn't

thanks

<{POST_SNAPBACK}>

Prevoius suggestions absolutely right for foreign windows. But if you work with Autoit GUI, simpler to use GUIGetCursorInfo, it's return control ID where mouse over (fourth element of return array).
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...