Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

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.

Posted

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

Posted

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

Posted

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]

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
×
×
  • Create New...