Sign in to follow this  
Followers 0
gottygolly

ControlMove is moving the wrong thing.

4 posts in this topic

Any thoughts on why it is moving the wrong button?

Func _Test($xCord,$yCord,$Width,$Height)
   GUICtrlCreateButton("",$xCord,$yCord,$Width,$Height)
   EndFunc
$gui = GUICreate("",300,300,-1,-1)
Opt("GUIOnEventMode",1)
$Test = _Test(50,50,100,20)
$Button = GUICtrlCreateButton("Button",0,0,100,20)
GUISetOnEvent(-3,"_Exit")
GUICtrlSetOnEvent($Button,"Button")
GUISetState()
While 1
   Sleep(10)
WEnd

Func _Exit()
   Exit
EndFunc

Func Button()
   $cp = ControlGetPos($gui,"",$Test)
   ControlMove($gui,"",$Test,$cp[0]+10,$cp[1]+10)
   EndFunc
1 person likes this

Share this post


Link to post
Share on other sites



_Test() needs to return the handle of the button created

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I feel dumb now.

Thanks for the help.

Edited by gottygolly

Share this post


Link to post
Share on other sites

I feel dumb now.

Thanks for the help.

 

Everyone makes silly code mistakes.  Use the rubber duck approach.

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