jhonson Posted June 14, 2019 Share Posted June 14, 2019 Hello, i'm learning autoit and i have come up with a problem. I wanted to create a help window from a button click, everything works clean except for the button which flickers. The flickering stops when i remove "GUICtrlSetState($help, $GUI_ENABLE)" line from the script and also when the "help" or "ok" button is clicked the flickering stops. What am i doing wrong? #RequireAdmin #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $main = GUICreate("", 317, 317, 1030, 115, $WS_POPUPWINDOW ,$WS_EX_TOPMOST) GUICtrlCreateLabel("", 0, 0, 222, 30, -1, $GUI_WS_EX_PARENTDRAG) Global $helpwindow = 9999, $ok GUISetState(@SW_SHOW) HotKeySet ("{numpad9}", "MyExit") $help = GUICtrlCreateButton("", 227, 3, 24, 24) While 1 $msg = GUIGetMsg() Select Case $msg = $help GUICtrlSetState($help, $GUI_DISABLE) $helpwindow = GUICreate("", 317, 317, 1030, 115, $WS_POPUPWINDOW ,$WS_EX_TOPMOST) GUISetState(@SW_SHOW) $ok = GUICtrlCreateButton("OK", 161, 277, 150, 34) Case $msg = $ok GUIDelete($helpwindow) GUICtrlSetState($help, $GUI_ENABLE) ;flickering stops when this line is removed EndSelect WEnd Func MyExit() Exit EndFunc Link to comment Share on other sites More sharing options...
Zedna Posted June 14, 2019 Share Posted June 14, 2019 (edited) #RequireAdmin #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $main = GUICreate("", 317, 317, 1030, 115, $WS_POPUPWINDOW ,$WS_EX_TOPMOST) $help = GUICtrlCreateButton("", 227, 3, 24, 24) GUICtrlCreateLabel("", 0, 0, 222, 30, -1, $GUI_WS_EX_PARENTDRAG) GUISetState(@SW_SHOW) $helpwindow = GUICreate("", 317, 317, 1030, 115, $WS_POPUPWINDOW ,$WS_EX_TOPMOST) $ok = GUICtrlCreateButton("OK", 161, 277, 150, 34) HotKeySet ("{numpad9}", "MyExit") While 1 $msg = GUIGetMsg() Select Case $msg = $help GUISetState(@SW_SHOW, $helpwindow) GUICtrlSetState($help, $GUI_DISABLE) Case $msg = $ok GUISetState(@SW_HIDE, $helpwindow) GUICtrlSetState($help, $GUI_ENABLE) EndSelect WEnd Func MyExit() Exit EndFunc Edited June 14, 2019 by Zedna jhonson 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
jhonson Posted June 14, 2019 Author Share Posted June 14, 2019 Thank you @Zedna, it was such a simple fix. Link to comment Share on other sites More sharing options...
Nine Posted June 14, 2019 Share Posted June 14, 2019 You do not even need 2 GUIs. Just one would work like this : ;#RequireAdmin #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $main = GUICreate("", 317, 317, 1030, 115, $WS_POPUPWINDOW ,$WS_EX_TOPMOST) $help = GUICtrlCreateButton("", 227, 3, 24, 24) GUICtrlCreateLabel("", 0, 0, 222, 30, -1, $GUI_WS_EX_PARENTDRAG) $ok = GUICtrlCreateButton("OK", 161, 277, 150, 34) GUICtrlSetState (-1, $GUI_HIDE) GUISetState(@SW_SHOW) HotKeySet ("{numpad9}", "MyExit") While 1 Switch GUIGetMsg() Case $help GUICtrlSetState($ok, $GUI_SHOW) GUICtrlSetState($help, $GUI_HIDE) Case $ok GUICtrlSetState($ok, $GUI_HIDE) GUICtrlSetState($help, $GUI_SHOW) EndSwitch WEnd Func MyExit() Exit EndFunc “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy 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