jvanegmond Posted May 16, 2006 Share Posted May 16, 2006 Look at this little test code i've built. It builds 2 squares and then moves them to the side. Looks ok to me, but watch what happens.. #include <GUIConstants.au3> Dim $graphic[2][3] GUICreate("test code", 600, 250, -1, -1, $WS_POPUP) GUISetBkColor(0) $graphic[0][0] = GUICtrlCreateGraphic(0, 0, 100, 100) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xffffff) GUICtrlSetGraphic(-1, $GUI_GR_RECT, 0, 0, 100, 100) $graphic[1][0] = GUICtrlCreateGraphic(0, 150, 100, 100) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xffffff) GUICtrlSetGraphic(-1, $GUI_GR_RECT, 0, 0, 100, 100) GUISetState() Sleep(4000) While 1 $graphic[0][1] += 50 GUICtrlSetPos($graphic[0][0], $graphic[0][1], $graphic[0][2]) Sleep(100) $graphic[1][1] += 50 GUICtrlSetPos($graphic[1][0], $graphic[1][1], $graphic[1][2]) Sleep(100) WEnd github.com/jvanegmond Link to comment Share on other sites More sharing options...
Developers Jos Posted May 16, 2006 Developers Share Posted May 16, 2006 and you wanted this ? #include <GUIConstants.au3> Dim $graphic[2][3] GUICreate("test code", 600, 250, -1, -1, $WS_POPUP) GUISetBkColor(0) $graphic[0][0] = GUICtrlCreateGraphic(0, 0, 100, 100) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xffffff) GUICtrlSetGraphic(-1, $GUI_GR_RECT, 0, 0, 100, 100) $graphic[1][0] = GUICtrlCreateGraphic(0, 150, 100, 100) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xffffff) GUICtrlSetGraphic(-1, $GUI_GR_RECT, 0, 0, 100, 100) GUISetState() Sleep(4000) While 1 $graphic[0][1] += 50 GUICtrlSetPos($graphic[0][0], $graphic[0][1], $graphic[0][2]) Sleep(100) $graphic[1][1] += 50 GUICtrlSetPos($graphic[1][0], $graphic[1][1], 150) Sleep(100) WEnd SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
jvanegmond Posted May 16, 2006 Author Share Posted May 16, 2006 (edited) That's Right. [Edit] I got it. It's the problem that i left a few vars in the array undefined, so when it moves to position "" it gives a error and somehow manages to remove the entire control. I've now just added $graphic[0][1] = $xcoord (pre defined in function) and ofcourse also for $graphic[0][2] = $ycoord Thanks for making me realise my mistake. Edited May 16, 2006 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
Developers Jos Posted May 16, 2006 Developers Share Posted May 16, 2006 That's Right.So you need to set the correct value for $graphic[0][2] and $graphic[1][2]. They are both zero so both squares are located at the same spot after the first move. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now