Sign in to follow this  
Followers 0
OminousIdol

Moving a Image?

8 posts in this topic

Hi, wrote a script to allow the Arrow Keys to move around a image... but it the flickers, grey background of the GUI will show through or random black lines will appear in the Image when it is being moved... I have no clue why its doing that and was wondering on how to fix it?

This is the code I am using...

#include <GUIConstants.au3>

Dim $cX = 0
Dim $cY = 0

$image = "img1.jpg"

HotKeySet("{UP}", "Up")
HotKeySet("{Down}", "Down")
HotKeySet("{Right}", "Right")
HotKeySet("{Left}", "Left")

GUICreate("test", 800, 600, 0, 0)

$pic = GUICtrlCreateLabel("", $cX, $cY, 60, 60)
GUICtrlSetBkColor($pic, 0x000000)

GUISetState()

While 1
    
    $gMsg = GUIGetMsg()
    If $gMsg = $GUI_EVENT_CLOSE Then ExitLoop

WEnd

Func Up()
    $cY = $cY - 10
    GUICtrlSetPos($pic, $cX, $cY)
EndFunc ;==>Up

Func Down()
    $cY = $cY + 10
    GUICtrlSetPos($pic, $cX, $cY)
    GUICtrlSetResizing($pic, $GUI_DOCKSIZE)
EndFunc ;==>Down

Func Right()
    $cX = $cX + 10
    GUICtrlSetPos($pic, $cX, $cY)
EndFunc ;==>Down

Func Left()
    $cX = $cX - 10
    GUICtrlSetPos($pic, $cX, $cY)
EndFunc ;==>Down

Thank You

Share this post


Link to post
Share on other sites



The problem you are addressing is due to the background being drawn before the image is drawn again. To solve this, you must implement a second device context to draw on, which would be very complicated in AutoIt, or find a way to prevent the background from being redrawn.

Share this post


Link to post
Share on other sites

I don't know if you're senile or anything, but there is seriously no need to create

another topic when you already got an identical one. Just post in that one !

Just incase you infact are senile here is the link to to other topic.

Share this post


Link to post
Share on other sites

Na, just made a new topic because my old was in the wrong section and no one else responded to it... but anyways anyone have anything useful to tell me?

Thanks

Share this post


Link to post
Share on other sites

Ok, but I wouldn't call "v3 Support" the wrong forum, since it it is AutoIt v3 you're

using, and you're also in the need for support. "v3 GUI" is an old forum and if I

remember correctly it was created at the time when AutoIt didn't have the GUI-

functions, but instead this forum was to be used for the special version of AutoIt

that Larry made, named AutoIt-GUI (or something like that).

Of course you couldn't have known that, but it's not needed to create another

topic just to get it in the right forum either. The moderators would most likely

have moved your first topic anyway :D

Share this post


Link to post
Share on other sites

Thats great... but that still doesnt help me...

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

@OminousIdol:

I believe what Icekirby1 was trying to say is something similar to example 2 of GUICtrlCreatePic in the help file. Take a look at it, it does the same stuff you're trying to make and no flickering takes place.

Hope this helps.

IVAN

Edited by ivan

Share this post


Link to post
Share on other sites

Use controlmove() it doesn't produce flickering


F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]

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