Jump to content

GUICtrlSetColor() on checkbox/radiobutton doesn't work on Windows 10


Zedna
 Share

Go to solution Solved by Nine,

Recommended Posts

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

image.png.ef1c2b00ea98760fc6f854aeb6a784a2.png

 

Edited by Zedna
Link to comment
Share on other sites

  • Solution
#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

Link to comment
Share on other sites

@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 by Zedna
Link to comment
Share on other sites

Just for the reference:

Here is the fix compatible with older versions of AutoIt (which I use) - derived from the mentioned above by Nine

#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 by Zedna
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...