funkey Posted May 5, 2010 Posted May 5, 2010 If I hide a Gui with GuiSetState and show it again with WinSetState, then I can't do anything with the Gui. All controls do not send messages. When I have only one Skript this is no probelm, because I always use GuiSetState to hide and show the guis, but if I have more scripts I can not use GuiSetState to show the Gui from another script. Should I always use WinSetState to hide Guis or is this a bug? #include <GUIConstantsEx.au3> GUICreate("Test bug with WinSetState", 210, 160) GUICtrlCreateLabel("Please test all buttons!", 10, 10) $YesID = GUICtrlCreateButton("Yes", 10, 50, 50, 20) $NoID = GUICtrlCreateButton("No", 80, 50, 50, 20) $BugID = GUICtrlCreateButton("Test Bug", 150, 50, 50, 20) $ListViewID = GUICtrlCreateListView("Test1|Test2", 10, 80, 190, 70) ; Set accelerators for y and n Dim $AccelKeys[2][2]=[["y", $YesID], ["n", $NoID]] GUISetAccelerators($AccelKeys) GUISetState() ; display the GUI Do $msg = GUIGetMsg() Select Case $msg = $YesID MsgBox(0, "You clicked on", "Yes") Case $msg = $NoID MsgBox(0, "You clicked on", "No") Case $msg = $ListViewID MsgBox(0, "You clicked on", "ListView") Case $msg = $BugID ;~ WinSetState('Test bug with WinSetState','',@SW_HIDE) ;hiding with WinSetState works GUISetState(@SW_HIDE) ; hide the GUI ;hiding with GuiSetState doesn't works Sleep(1000) WinSetState('Test bug with WinSetState','',@SW_SHOW) EndSelect Until $msg = $GUI_EVENT_CLOSE Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning.
zorphnog Posted May 5, 2010 Posted May 5, 2010 You can use WinSetState to hide the window as well and everything is ok. I would suggest using that or incorporating all your GUIs/Scripts into one script. I've never seen the source code, but I imagine that GuiSetState handles processing for gui messages of the controls internally. By hiding the window using GuiSetState, the processing of the messages is stopped for performance improvements. Showing the window using WinSetState does not re-enable the processing of those messages and therefore you see the problem you are getting. Using WinSetState exclusively, you will technically be slightly degrade performance, but I doubt that you will be able to notice it.
funkey Posted May 5, 2010 Author Posted May 5, 2010 Thanks a lot, zorphnog. I will now use WinSetState for all Guis I want to hide. I don't think performance will be a problem. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning.
InternetMonkeyBoy Posted January 29, 2021 Posted January 29, 2021 Apples and oranges, but you can mix them. The trick is you hide the control, make your change and then show the control. I had that same problem and then I switched to GUISetState instead of WinSetstate and no longer had to do that. 11 years late, sorry, but for the next person looking for 'How to change a GUI control without hiding it first.'
Moderators JLogan3o13 Posted January 29, 2021 Moderators Posted January 29, 2021 @InternetMonkeyBoy as you yourself acknowledge, this post is over 10 years old. Please don't resurrect old threads; especially when the OP states he found a resolution. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Recommended Posts