shavenlunatic
MIS
Hi, moving a picture box around the screen following a mouse click (i know its only moving left/right at the moment, but thats not my concern... yet! heheh). This works fine and the image moves to where the mouse clicked. BUT, if i click again, or several times, while it is moving, it causes all hell to break loose and the image to start trying to perform all actions, previous and current. How can i put a check in to see if it is already processing a mousedown action and over=ride the current?
Code:
Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
startx = frmmapscreen.imgchar.Left
starty = frmmapscreen.imgchar.Top
If X > startx Then
stepx = 5
Else
stepx = -5
End If
If Y > starty Then
stepy = 5
Else
steyp = -5
End If
For movex = startx To X Step stepx
PauseTime = 0.05 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop
frmmapscreen.imgchar.Left = movex
Next movex
End Sub
Thanks in advance. I know my questions have been a bit random lately :)
________
clueless