Sign in to follow this  
Followers 0
onedayillpay

GuiCtrlCreatePic

4 posts in this topic

i think i know why this doesnt work, so can some one show me how i can make this merlin.gif move

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$pic2_left = 150
$pic2_top = 20
$Pic_2 = GuiCtrlCreatePic(@Systemdir & "\oobe\images\merlin.gif", $pic2_left,$pic2_top, 60, 60)


$Input_1 = GuiCtrlCreateInput("", 100, 80, 20, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE 
        ExitLoop
    Case $msg = $Input_1
        if GUICtrlRead($Input_1) = "2" then
            $pic2_left = 150; pictur move
            $pic2_top = 90
            EndIf
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites



This one works

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$pic2_left = 150
$pic2_top = 20
$Pic_2 = GuiCtrlCreatePic(@Systemdir & "\oobe\images\merlin.gif", $pic2_left,$pic2_top, 60, 60)


$Input_1 = GuiCtrlCreateInput("", 100, 80, 20, 20)
$Button1 = GUICtrlCreateButton("Move", 60, 80, 40, 20, 0)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE 
        ExitLoop
    Case $msg = $Button1
        if GUICtrlRead($Input_1) = "2" then
            $pic2_left = 150
            $pic2_top = 90
            GUICtrlSetPos ($Pic_2,$pic2_left,$pic2_top)
            EndIf
    EndSelect
WEnd
Exit


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

ahhh I see... thanks

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

i dont understand why the secend time you enter 2 in to the input box, the pic2.bmp wont move back...

$pic2_left = 150
$pic2_top = 20
$Pic_2 = GuiCtrlCreatePic(@DesktopDir & "\puzzle\pic2.bmp", $pic2_left,$pic2_top, 60, 60)
$freespotLeft = 150
$freespotTop = 90
$input = GUICtrlCreateInput ("", 170,  240, 20, 20)
$move = GUICtrlCreateButton("Move", 160, 260, 40, 20, 0)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $move;    Button
        if GUICtrlRead($Input) = "2" then
            if $freespotLeft = 150 Then
                if $freespotTop = 90 Then
            $pic2_left = 150
            $pic2_top = 90
            $freespotLeft = 150
            $freespotTop = 20
            GUICtrlSetPos ($Pic_2,$pic2_left,$pic2_top)
                EndIf
            EndIf
        EndIf
    Case $msg = $move;    Button
        if GUICtrlRead($Input) = "2" then
            if $freespotLeft = 150 Then
                if $freespotTop = 20 Then
                $pic2_left = 150
            $pic2_top = 20
            $freespotLeft = 150
            $freespotTop = 90
            GUICtrlSetPos ($Pic_2,$pic2_left,$pic2_top)
                 EndIf
            EndIf
        EndIf

    
    EndSelect
WEnd
Exit
Edited by onedayillpay

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