Jump to content

Recommended Posts

Posted
On 1/11/2025 at 8:48 AM, WildByDesign said:

Those are nice themes. Personally, specifically for dark mode only, I use Rectify11 theme for Windows. Rectify11 actually fixes the problem with the ListView checkboxes. However, for the apps that I make, I end up having to target default Aero theme (dark and light) because that is what the majority of users would be using.

My main PC broke :(

So, new PC, new setup. Installed the current Rectify11 and, it messed up the PC. Patched files left an right.
I went to use the registry and oops, it would not load. Therefore, uninstall it is. Nope, the uninstaller is missing.
Now after a few hours of setting up my Win11-24H2, I have to erase it and install again.

Warning: test in a VM and if all looks good, do the same in the hardware PC. In my experience, they are chewing more than they should try to bite. I will not try it again.
There is no need to patch everything under the sun to make a decent dark theme. :tv_horror:

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted
20 hours ago, argumentum said:

In my experience, they are chewing more than they should try to bite. I will not try it again.
There is no need to patch everything under the sun to make a decent dark theme.

I agree 100% about not patching everything. I apologize that you had such a bad experience.

I should have gave you more details initially but I did not want to go too far off-topic. I don't like patching digitally signed files since it breaks the signatures. So what I did was write a system tray tool in AutoIt that simply switches msstyles. So I grab the msstyles (theme files) only from Rectify11 repo and only use that. That way the system can't be broken from it since no files are being patched.

Anyway, I don't want to further go off-topic here. But you can feel free to private message here in the forum anytime if you need to.

  • 2 months later...
Posted

@argumentum I found and fixed an issue with your _HiDpi_Ctrl_LazyInit() function on 64-bit systems:

Func _HiDpi_Ctrl_LazyInit($iCONTEXT = -2) ; under the current state of developnment, -2 is the best option for this UDF.
    If $iCONTEXT <> Null Then
        If Not ($iCONTEXT < -1 And $iCONTEXT > -5) Then $iCONTEXT = -2
        ;DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", "int", $iCONTEXT) ; not working on 64-bit
        DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", $iCONTEXT) ; working on 64-bit
    EndIf
    _HiDpi_CtrlSetVarDPI( _HiDpi_GetDpiForWindow())
    _HiDpi_CtrlSetVarRatio(_HiDpi_CtrlSetVarDPI() / 96)
EndFunc   ;==>_HiDpi_Ctrl_LazyInit

 

Posted

One thing that bothered me for a while was how regular checkboxes would get the dark theme but ListView checkboxes ($LVS_EX_CHECKBOXES) would not and it would be a significant contrast. This is not a limitation of AutoIt but actually a limitation of Windows dark mode Aero theme.

Before, regular checkboxes would be in dark mode and listview checkboxes would be in light mode.

I have attached the dark mode checkboxes to this post and each ICO file contains all sizes (13, 16, 20, 26, 32, 40, 52 pixels).

All you need is the following code after dark mode has been applied:

If $isDarkMode = True Then
    $hImageList = _GUICtrlListView_GetImageList($hListView, 2)
    _GUIImageList_Remove($hImageList)
    _GUIImageList_AddIcon($hImageList, "unchecked.ico")
    _GUIImageList_AddIcon($hImageList, "checked.ico")
EndIf

 

Alternatively, you can add the icons as resources for compiled binaries like this:

#AutoIt3Wrapper_Res_Icon_Add=unchecked.ico
#AutoIt3Wrapper_Res_Icon_Add=checked.ico


; this part must be applied AFTER dark mode has already been set
If $isDarkMode = True Then
    $hImageList = _GUICtrlListView_GetImageList($hListView, 2)
    _GUIImageList_Remove($hImageList)

    If @Compiled = 0 Then
        _GUIImageList_AddIcon($hImageList, "unchecked.ico")
        _GUIImageList_AddIcon($hImageList, "checked.ico")
    Else
        _GUIImageList_AddIcon($hImageList, @ScriptFullPath, 3)
        _GUIImageList_AddIcon($hImageList, @ScriptFullPath, 4)
    EndIf
EndIf

 

Screenshot:

image.thumb.png.a27c041ef20d2040c23934a2a7e70782.png

DarkModeCheckboxes.zip

Posted
2 hours ago, WildByDesign said:
#AutoIt3Wrapper_Res_Icon_Add=unchecked.ico
#AutoIt3Wrapper_Res_Icon_Add=checked.ico
#AutoIt3Wrapper_Res_Icon_Add=unchecked.ico, 201
#AutoIt3Wrapper_Res_Icon_Add=checked.ico, 202

Global $g_Compiled = Int(@AutoItExe = @ScriptFullPath) ; better than @Compiled
ConsoleWrite("- $g_Compiled = " & $g_Compiled & @CRLF)

; this part must be applied AFTER dark mode has already been set
If $isDarkMode = True Then
    $hImageList = _GUICtrlListView_GetImageList($hListView, 2)
    _GUIImageList_Remove($hImageList)

;~     If @Compiled = 0 Then ; Returns 1 if script is a compiled executable or an .a3x file; returns 0 if an .au3 file.
    If $g_Compiled Then
        _GUIImageList_AddIcon($hImageList, @ScriptFullPath, 201) ; because it can become a game of chance as you add/remove code
        _GUIImageList_AddIcon($hImageList, @ScriptFullPath, 202) ; so is better to declare it.
    Else
        _GUIImageList_AddIcon($hImageList, "unchecked.ico")
        _GUIImageList_AddIcon($hImageList, "checked.ico")
    EndIf
EndIf

I strongly believe that declaring the resource number is better.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted
14 minutes ago, argumentum said:

I strongly believe that declaring the resource number is better.

Thank you for this. I did not know that we could specify the resource number. But now that you told me, I agree with you about declaring it.

By the way, do you know of any method to programmatically obtain the checkbox images?

What I mean is, not including the ICO files at all. But instead, have a dark mode regular checkbox and somehow obtain the state ImageList from that which I believe falls under button category. Then take that ImageList and apply it to the ListView state ImageList similar to my code above.

I understand that a regular checkbox has more visual states compared to ListView checkbox states. So we would have to be able to select which states to apply and which to discard.

We might need some super high level AutoIt gurus to help with that question.

I think that if we could do this in a programmatic way it would be better. Especially if a user is using a theme other than Aero.

Posted
22 minutes ago, WildByDesign said:

...have a dark mode regular checkbox and somehow obtain the state ImageList from that which...

I am a special type of coder. I'd call me a channeler or medium that knows what is needed and then, just like an angel, forgot, as it's all an eternal now.
( meaning that I google like a maniac, copy and paste until am done, and go to sleep, not to remember what I did because I never knew how anything works  ) 

But maybe those that know GDI can cook an image out of code ( like in the SizeGrip code ) and that'd be nice to have.
Or find a way to just change the color of the checkbox text, because after all, a checkbox is a button of sorts ( low level wise ).

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

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
×
×
  • Create New...