Jump to content

Recommended Posts

Posted (edited)

GUICreate("Question", 185, 107, -1, -1, -1)
GUICtrlCreateButton("Yes", 20, 60, 61, 35)
GUICtrlCreateButton("No", 100, 60, 61, 35)
GUICtrlCreateLabel("Are you dreaming?", 60, 20, 75, 40)
GUISetState()
While 1
$Mouse = MouseGetPos()
$P1 = $Mouse[0]
$P2 = $Mouse[1]
If $P1 = 141 <= 199 Then
no()
ElseIf $P2 = 554 <= 586 Then
no()
Else
GUICtrlSetState(4, $GUI_ENABLE)
EndIf
Wend
Func no()
GUICtrlSetState(4, $GUI_DISABLE)
EndFunc

Im hoping the "No" button will disable if you put your mouse over it but all i get is an error right off the bat.

Edited by Errorlevel_03
I hope you know what a spoiler is...[u]"title WOOPS:Var_start "WOOPS" %0goto Var_"-A true n00b at work[/u]
Posted (edited)

Errorlevel 03, look at this example

For questions, see the help file (and the examples in it)

I hope that this helps you on your way.

Dick

#include <GUIConstants.au3>

$Hide = False

GUICreate("Question", 185, 107, -1, -1, -1)

$Yes = GUICtrlCreateButton("Yes", 20, 60, 61, 35)

$No = GUICtrlCreateButton("No", 100, 60, 61, 35)

GUICtrlCreateLabel("Are you dreaming?", 60, 20, 75, 40)

GUISetState()

OPt("MouseCoordMode", 2)

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

EndSelect

$Mouse = MouseGetPos()

$P1 = $Mouse[0]

$P2 = $Mouse[1]

If ($P1 > 99 And $P1 < 161) And ($P2 > 59 And $P2 < 97) Then

If ($Hide = False) Then no()

ElseIf ($Hide = True) Then

$Hide = False

GUICtrlSetState(4, $GUI_ENABLE)

EndIf

WEnd

Exit

Func no()

$Hide = True

GUICtrlSetState(4, $GUI_DISABLE)

EndFunc ;==>no

Edited by Dickb
Posted

If $P1 = 141 <= 199 Then
no()
ElseIf $P2 = 554 <= 586 Then
no()
Else
GUICtrlSetState(4, $GUI_ENABLE)
EndIf

This will cause you errors. I think you are after this:

if ($p1 >= 141 and $p1 <= 199) then
    no()
elseIf ($p2 >= 554 and $p2 <= 586) then
    no()
else
    guiCtrlSetState(4, $GUI_ENABLE)
endIf

Each condition within an If..Then instruction must be complete on its own.

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
  • Recently Browsing   0 members

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