Jump to content
Sign in to follow this  
gottygolly

ControlMove is moving the wrong thing.

Recommended Posts

gottygolly

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
  • Like 1

Share this post


Link to post
Share on other sites
kaisies

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

Share this post


Link to post
Share on other sites
gottygolly

I feel dumb now.

Thanks for the help.

Edited by gottygolly

Share this post


Link to post
Share on other sites
kaisies

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  

×