Zedna Posted February 18, 2020 Posted February 18, 2020 (edited) GUICtrlSetColor() on checkbox/radiobutton doesn't work on Windows 10. On Windows 7 it works OK but on Windows 10 color of checkbox/radiobutton remains default black. GUICtrlSetBkColor() is OK. Other controls (label,button) are OK. EDIT: Testing on AutoIt 3.3.14.5, Windows 10 without Aero (Classic theme). I'm about to write ticket to BugTrack, can somebody confirm this bug? EDIT2: The same problem is also with RadioButton #include <GUIConstants.au3> GUICreate("Test", 400, 300) GUICtrlCreateLabel("Test", 10, 10, 50, 23) GUICtrlCreateButton("Test", 10, 50, 50, 23) GUICtrlCreateCheckbox("Test", 10, 100, 50, 23) GUICtrlCreateRadio("Test", 10, 150, 50, 23) GUICtrlCreateLabel("Test", 110, 10, 50, 23) GUICtrlSetColor(-1, 0x00FF00) GUICtrlCreateButton("Test", 110, 50, 50, 23) GUICtrlSetColor(-1, 0x00FF00) GUICtrlCreateCheckbox("Test", 110, 100, 50, 23) GUICtrlSetColor(-1, 0x00FF00) ; --> here is problem GUICtrlCreateRadio("Test", 110, 150, 50, 23) GUICtrlSetColor(-1, 0x00FF00) ; --> here is problem GUICtrlCreateLabel("Test", 210, 10, 50, 23) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateButton("Test", 210, 50, 50, 23) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateCheckbox("Test", 210, 100, 50, 23) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateRadio("Test", 210, 150, 50, 23) GUICtrlSetBkColor(-1, 0x00FF00) GUISetState(@SW_SHOW) While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit WEnd Edited February 18, 2020 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Solution Nine Posted February 18, 2020 Solution Posted February 18, 2020 #include <GUIConstants.au3> #include <WinAPITheme.au3> GUICreate("Test", 400, 300) GUICtrlCreateLabel("Test", 10, 10, 50, 23) GUICtrlCreateButton("Test", 10, 50, 50, 23) GUICtrlCreateCheckbox("Test", 10, 100, 50, 23) GUICtrlCreateRadio("Test", 10, 150, 50, 23) GUICtrlCreateLabel("Test", 110, 10, 50, 23) GUICtrlSetColor(-1, 0x00FF00) GUICtrlCreateButton("Test", 110, 50, 50, 23) GUICtrlSetColor(-1, 0x00FF00) $idCB = GUICtrlCreateCheckbox("Test", 110, 100, 50, 23) _WinAPI_SetWindowTheme (GUICtrlGetHandle($idCB), "0", "0") GUICtrlSetColor(-1, 0x00FF00) ; --> NO problem $idRB = GUICtrlCreateRadio("Test", 110, 150, 50, 23) _WinAPI_SetWindowTheme (GUICtrlGetHandle($idRB), "0", "0") GUICtrlSetColor(-1, 0x00FF00) ; --> No problem GUICtrlCreateLabel("Test", 210, 10, 50, 23) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateButton("Test", 210, 50, 50, 23) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateCheckbox("Test", 210, 100, 50, 23) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateRadio("Test", 210, 150, 50, 23) GUICtrlSetBkColor(-1, 0x00FF00) GUISetState(@SW_SHOW) While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit WEnd Working for me on Win 10 Zedna 1 “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
Zedna Posted February 18, 2020 Author Posted February 18, 2020 (edited) @Nine Thanks for the FIX/WORKAROUND! Works for me. Anyway I'm surprised as I use Classic theme so I thought theme shouldn't be problem ... EDIT: Now I checked my theme and it was Classic in Win7 and after update to Win 10 it's not Classic anymore and there is also Windows transparency ON so I can understand why this fix is related to my problem (on my configuration) EDIT2: Anyway mystery remains why only checkbox/radiobutton have this bug and label/button are OK. So some BUG is somewhere and this is only workaround ... Edited February 18, 2020 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Nine Posted February 18, 2020 Posted February 18, 2020 “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
Zedna Posted February 18, 2020 Author Posted February 18, 2020 (edited) Just for the reference: Here is the fix compatible with older versions of AutoIt (which I use) - derived from the mentioned above by Nine expandcollapse popup#include <GUIConstants.au3> ;~ #include <WinAPITheme.au3> GUICreate("Test", 400, 300) GUICtrlCreateLabel("Test", 10, 10, 50, 23) GUICtrlCreateButton("Test", 10, 50, 50, 23) GUICtrlCreateCheckbox("Test", 10, 100, 50, 23) GUICtrlCreateRadio("Test", 10, 150, 50, 23) GUICtrlCreateLabel("Test", 110, 10, 50, 23) GUICtrlSetColor(-1, 0x00FF00) GUICtrlCreateButton("Test", 110, 50, 50, 23) GUICtrlSetColor(-1, 0x00FF00) $idCB = GUICtrlCreateCheckbox("Test", 110, 100, 50, 23) ;~ _WinAPI_SetWindowTheme (GUICtrlGetHandle($idCB), "0", "0") DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($idCB), "wstr", "", "wstr", "") GUICtrlSetColor(-1, 0x00FF00) ; --> NO problem $idRB = GUICtrlCreateRadio("Test", 110, 150, 50, 23) ;~ _WinAPI_SetWindowTheme (GUICtrlGetHandle($idRB), "0", "0") DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($idRB), "wstr", "", "wstr", "") GUICtrlSetColor(-1, 0x00FF00) ; --> No problem GUICtrlCreateLabel("Test", 210, 10, 50, 23) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateButton("Test", 210, 50, 50, 23) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateCheckbox("Test", 210, 100, 50, 23) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateRadio("Test", 210, 150, 50, 23) GUICtrlSetBkColor(-1, 0x00FF00) GUISetState(@SW_SHOW) While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit WEnd Edited February 18, 2020 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
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