Jump to content
Sign in to follow this  
keen

Help Please!

Recommended Posts

keen

Hey, i am making a code so when a gui moves into a place it pops up a message. why isnt the message poping up?

Here is the code:

#include "GUIConstants.au3"

$gui=GUICreate("Take your dog on a walk", 618, 442, 226, 145, -1, $WS_EX_TOOLWINDOW)

$Pic1 = GUICtrlCreatePic(@ScriptDir & "\walk.gif", 0, 0, 617, 441)

$pic=GUICreate("", 49, 57, 5, 350,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)
$guy = GUICtrlCreatePic(@ScriptDir & "\guyfarward.gif",0,0, 0,0)

$pic2=GUICreate("", 68, 100, 162, 237,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)
$Pic5 = GUICtrlCreatePic(@ScriptDir & "\door.gif", 0, 0, 0, 0)

GUISetState(@SW_SHOW,$pic)
GUISetState(@SW_SHOW,$gui)

HotKeySet("{LEFT}", "left")
HotKeySet("{RIGHT}", "right")
HotKeySet("{DOWN}", "down")
HotKeySet("{UP}", "up")

$picPos = WinGetPos($pic)
$guiPos = WinGetPos($gui)
$pic2pos = WinGetPos ($pic2)


While 1
    $msg = GuiGetMsg()
    
    $picPos = WinGetPos($pic)
    $pic2pos = WinGetPos($pic2)
    
    If $picPos[0] And $picPos[1] = $pic2pos[0] And $pic2pos[1] Then
        MsgBox (0,"hi","hi")
    EndIf
    
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    EndSelect
WEnd
Exit


Func left ()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0]-5,$picPos[1])
    GUICtrlSetImage ($guy, @ScriptDir & "\guybackward.gif")
EndFunc

Func right()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0]+5,$picPos[1])
    GUICtrlSetImage ($guy, @ScriptDir & "\guyfarward.gif")
EndFunc

Func down()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0],$picPos[1]+5)
EndFunc

Func up()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0],$picPos[1]-5)
EndFunc

[center]Kesne's Bar & Grill[/center]

Share this post


Link to post
Share on other sites
DW1

If $picPos[0] And $picPos[1] = $pic2pos[0] And $pic2pos[1] Then

MsgBox (0,"hi","hi")

EndIf

I don't think that syntax is correct, did you mean:

If $picPos[0] = $pic2pos[0] And $picPos[1]  = $pic2pos[1] Then
    MsgBox (0,"hi","hi")
EndIf

Share this post


Link to post
Share on other sites
keen

Well with that it give me a one pixel point to hit to open the essage box. I need the whole are avalible to hit.


[center]Kesne's Bar & Grill[/center]

Share this post


Link to post
Share on other sites
keen

I cant get that to work with these values:

$LEFTVALUE = "162"

$TOPVALUE = "237"

$RIGHTVALUE = "230"

$BOTVALUE = "337"

Why not?


[center]Kesne's Bar & Grill[/center]

Share this post


Link to post
Share on other sites
keen

No message box is popping up!


[center]Kesne's Bar & Grill[/center]

Share this post


Link to post
Share on other sites
keen

Bump!

The message box still wont pop up


[center]Kesne's Bar & Grill[/center]

Share this post


Link to post
Share on other sites
keen

NVM, i got it working. thanks for the help!


[center]Kesne's Bar & Grill[/center]

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.