cupcake Posted September 12, 2011 Share Posted September 12, 2011 (edited) Hi, after I changed a buttons color, I want to restore the initial style (3D, Windows-grey). Here is the code, the button is supposed to be blinking: GUICtrlSetBkColor($buttoncontrol, 0xff00) ;green Sleep($2000) GUICtrlSetBkColor($buttoncontrol, ??? ) ;back to normal Sleep($2000) GUICtrlSetBkColor($buttoncontrol, 0xff00) ;green What I did in the past was this: GUICtrlDelete($buttoncontrol) $buttoncontrol = GUICtrlCreateButton("", 125, 260, 100, 30) GUICtrlSetState($buttoncontrol, $GUI_SHOW) But this seems to be a weird work around. I hope there is a better way Thanks for your help. Edited September 12, 2011 by cupcake Link to comment Share on other sites More sharing options...
UEZ Posted September 12, 2011 Share Posted September 12, 2011 (edited) Try this: #include <Constants.au3> #include <GUIConstantsEx.au3> #Include <WinAPI.au3> #Include <WindowsConstants.au3> $hGUI = GUICreate("Test", 245, 151, 192, 124) $Button = GUICtrlCreateButton("Reset Color", 37, 23, 171, 105) $hButton = GUICtrlGetHandle($Button) $Button_Style = _WinAPI_GetWindowLong($hButton, $GWL_STYLE) $Button_ExStyle = _WinAPI_GetWindowLong($hButton, $GWL_EXSTYLE) $Button_DefColor = _WinAPI_GetSysColor($COLOR_BTNFACE) GUISetState(@SW_SHOW) GUICtrlSetBkColor($Button, 0xA0F0A0) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button GUICtrlSetBkColor($Button, $Button_DefColor) _WinAPI_SetWindowLong($hButton, $GWL_STYLE, $Button_Style) _WinAPI_SetWindowLong($hButton, $GWL_EXSTYLE, $Button_ExStyle) _WinAPI_RedrawWindow($hButton) EndSwitch WEnd Br, UEZ Edited September 12, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
cupcake Posted September 12, 2011 Author Share Posted September 12, 2011 (edited) Hey, thank you for the quick reply. This looks better and more sophisticated. Kind regards. Edited September 12, 2011 by cupcake Link to comment Share on other sites More sharing options...
KaFu Posted September 13, 2011 Share Posted September 13, 2011 Or something like this ? #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("My GUI") $c_Button = GUICtrlCreateButton("Button", 10, 10, 100, 30) GUICtrlSetBkColor($c_Button, 0xff00) GUISetState(@SW_SHOW) Sleep(2000) GUICtrlSetStyle($c_Button, $GUI_SS_DEFAULT_BUTTON) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) 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