Madza91 Posted September 6, 2008 Share Posted September 6, 2008 Is this Bug or i don't know use this command (ControlMove) ^^ When move some control and minimize window, moved control get back on 1st position... #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 633, 447, 193, 125) $Label0 = GUICtrlCreateLabel("| 1st Position | | 2nd Position |", 50, 50, 500, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Label1 = GUICtrlCreateLabel("| Label |", 50, 70, 100, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) Sleep(500) ControlMove($Form1, "", $Label1, 310,70,100,20) Sleep(100) WinSetState($Form1, "", @SW_MINIMIZE) Sleep(100) WinSetState($Form1, "", @SW_RESTORE) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
Nahuel Posted September 7, 2008 Share Posted September 7, 2008 That is weird... i tried different ways, but same result :S Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 7, 2008 Moderators Share Posted September 7, 2008 The window is repainting itself as it was written, not what you decided to do to it outside the code source. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Madza91 Posted September 7, 2008 Author Share Posted September 7, 2008 And how to fix that? Something like this or exist better way? #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 633, 447, 193, 125) $Label0 = GUICtrlCreateLabel("| 1st Position | | 2nd Position |", 50, 50, 500, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Label1 = GUICtrlCreateLabel("| Label |", 50, 70, 100, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) Sleep(500) ControlMove($Form1, "", $Label1, 310,70,100,20) $Label2 = GUICtrlCreateLabel("| Label |", 310,70,100,20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlDelete($Label1) Sleep(100) WinSetState($Form1, "", @SW_MINIMIZE) Sleep(100) WinSetState($Form1, "", @SW_RESTORE) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 7, 2008 Moderators Share Posted September 7, 2008 And how to fix that? Something like this or exist better way? #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 633, 447, 193, 125) $Label0 = GUICtrlCreateLabel("| 1st Position | | 2nd Position |", 50, 50, 500, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Label1 = GUICtrlCreateLabel("| Label |", 50, 70, 100, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) Sleep(500) ControlMove($Form1, "", $Label1, 310,70,100,20) $Label2 = GUICtrlCreateLabel("| Label |", 310,70,100,20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlDelete($Label1) Sleep(100) WinSetState($Form1, "", @SW_MINIMIZE) Sleep(100) WinSetState($Form1, "", @SW_RESTORE) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEndThe "fix" would be to memory edit after the controlmove for the starting position of the control to its current location. To do something like that in your own GUI, the easiest way would be to set a function that does it on restore and or minimize. Make the function change the control location before it is restored, it is repainted with the new control location (making the variables dynamic rather than statically coding them like you are above). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
rasim Posted September 7, 2008 Share Posted September 7, 2008 n3nEAnd how to fix that?If for your GUI, try to use a GuiCtrlSetPos() function. Link to comment Share on other sites More sharing options...
Madza91 Posted September 7, 2008 Author Share Posted September 7, 2008 Oh, i forgot that command Thanks [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
Bowmore Posted September 7, 2008 Share Posted September 7, 2008 To do something like that in your own GUI, the easiest way would be to set a function that does it on restore and or minimize. Make the function change the control location before it is restored, it is repainted with the new control location (making the variables dynamic rather than statically coding them like you are above).One problem with the above, which I have used myself occasionally, is that WinSetState($Form1, "", @SW_RESTORE) does not seem to generate a $GUI_EVENT_RESTORE message. Manually clicking on the app in the TaskBar to restore it does generate the $GUI_EVENT_RESTORE message enabling you to move the control back to the desired position. "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook 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