Sign in to follow this  
Followers 0
gottygolly

Checker.

4 posts in this topic

Wasn't sure what to name the title...

I know what the problem is I was just wondering how I would go about making it so when the mouse isn't on the button it just makes the gui background color white 1 time instead of how it's currently doing it (Making it white infinite amount of times).

Any solutions will help, thanks!

Func _Mouse_Hover($Control)
   $Title = WinGetTitle("")
   $ControlPos = ControlGetPos($Title,"",$Control)
   $MousePos = GUIGetCursorInfo($Title)
   If $MousePos[0] > $ControlPos[0] And $MousePos[0] < $ControlPos[0] + $ControlPos[2] And $MousePos[1] > $ControlPos[1] And $MousePos[1] < $ControlPos[1] + $ControlPos[3] Then
      GUISetBkColor(0x000000)
   Else
      GUISetBkColor(0xFFFFFF)
      EndIf
   EndFunc

Share this post


Link to post
Share on other sites



How many times are you calling that function?

As it will stay the specified color until the function is called again, and mouse position has changed.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

The second time this function will run will not make the background white

Global $checker = False
Func _Mouse_Hover($Control)
   $Title = WinGetTitle("")
   $ControlPos = ControlGetPos($Title,"",$Control)
   $MousePos = GUIGetCursorInfo($Title)
   If $MousePos[0] > $ControlPos[0] And $MousePos[0] < $ControlPos[0] + $ControlPos[2] And $MousePos[1] > $ControlPos[1] And $MousePos[1] < $ControlPos[1] + $ControlPos[3] Then
      GUISetBkColor(0x000000)
   Else
   If $checker = False Then
  GUISetBkColor(0xFFFFFF)
  $checker = True
   EndIf
      EndIf
EndFunc

Share this post


Link to post
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
Sign in to follow this  
Followers 0