Jump to content

Recommended Posts

Posted

System Menu text colors (when you click on the Autoit icon in the left upper corner) and slider thumb are not working properly. Slider thumb is changing the color when dragged.

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted
1 hour ago, argumentum said:

So, as a default you add "#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7"

Thanks. I just updated the UDF with your fixed DRAWITEM function in your comment just below this.

Good news, it looks like this Au3Check line works in VSCodium / VSCode as well. So I will be able to fix some stuff there too.

Posted
14 minutes ago, UEZ said:

System Menu text colors (when you click on the Autoit icon in the left upper corner)

Thanks for your feedback. Which OS build are you experiencing the text color issue with the system menu?

The system menu from the AutoIt icon in the left corner shows properly on mine. Mine is 25H2 with latest updates (26200.7840). I wonder if we may need different tricks for different OS versions possibly.

14 minutes ago, UEZ said:

and slider thumb are not working properly. Slider thumb is changing the color when dragged.

Yes, I did notice this. I saw how you have recently subclassed the slider control. Great work on that, by the way. From what I recall, you subclassed the whole slider control. Is it possible only to subclass the thumb part?

Posted
7 minutes ago, WildByDesign said:

Thanks for your feedback. Which OS build are you experiencing the text color issue with the system menu?

The system menu from the AutoIt icon in the left corner shows properly on mine. Mine is 25H2 with latest updates (26200.7840). I wonder if we may need different tricks for different OS versions possibly.

Yes, I did notice this. I saw how you have recently subclassed the slider control. Great work on that, by the way. From what I recall, you subclassed the whole slider control. Is it possible only to subclass the thumb part?

I'm on Win11 24H2.

image.png

WM_NOTIFY should only change the thumb - not the whole slider control but if you change the style of the control, it would not fit with current setting. For the demo it is ok not if you use different styles.

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted
4 minutes ago, UEZ said:

I'm on Win11 24H2.

image.png

This is really interesting. It seems that the items which are missing are only the ones which have an icon. This is definitely a problem but I am not sure what could cause this.

Do you have any idea what could possibly cause this?

Posted
3 hours ago, argumentum said:

add this to all your scripts: #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
If needed, add these ( as an example ) : #forceref $hwnd, $iMsg, $wParam, $lParam

I have fixed the rest of these for the next release. Thanks for helping me to understand how it works.

Posted (edited)

Confirming that the AutoIt icon is working correctly on my side (also Win11 25H2). 

Also found a small bug.
1- click on Menu One (leave it opened)
2- click on calendar drop down (leave it opened)
3- click on any other control
Border of the calendar is only partially erased

ps. got also white Menu One

Edited by Nine
Posted

Those are all very helpful details, @Nine. I appreciate it.

The top menus, context menu and the system menu (AutoIt icon) all get generated by the OS each time we open them. All of them get a new handle each click as well.

I think what I might do is try using a WinEventHook (for that PID only) which will give me the handle each time a menu is opened. I may try hitting the dark mode functions that way for the various menus.

Posted (edited)

Thanks to @Nine's details, I have discovered a bug but I need help to fix it properly. The bug is affecting GUIDarkTheme and also @UEZ's SampleControls.au3 in Dark Mode.

Basically, if you click on the datetimepicker first, then the menus will be light mode.

; --- Per-control notification handling ---
    Switch $hWndFrom
        Case $g_hDate ; thanks to argumentum for the code :-)
            Switch $iCode
                Case $NM_SETFOCUS
                    ; Disable visual theme when DateTime control receives focus
                    _WinAPI_SetThemeAppProperties(0)

                Case $DTN_DROPDOWN
                    ; Apply dark colors when the calendar dropdown opens
                    _WinAPI_SetWindowTheme($iCtrl, "", "")
                    Local $iCtrl = _GUICtrlDTP_GetMonthCal($hWndFrom)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TEXT,         $COLOR_TEXT_LIGHT)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLEBK,      $COLOR_BG_DARK)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLETEXT,    $COLOR_TEXT_LIGHT)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_MONTHBK,      $COLOR_BG_DARK)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TRAILINGTEXT, $COLOR_TEXT_LIGHT)

                Case $DTN_CLOSEUP
                    ; Calendar dropdown closed - no action needed

            EndSwitch
    EndSwitch

It is the _WinAPI_SetThemeAppProperties(0) which is persisting, which makes sense. We need to get and restore it after.

Here is what I am testing right now:

; --- Per-control notification handling ---
    Switch $hWndFrom
        Case $g_hDate ; thanks to argumentum for the code :-)
            Local Static $iTheme
            Switch $iCode
                Case $NM_SETFOCUS
                    ; Store previous theme settings
                    $iTheme = _WinAPI_GetThemeAppProperties()
                    ; Disable visual theme when DateTime control receives focus
                    _WinAPI_SetThemeAppProperties(0)

                Case $DTN_DROPDOWN
                    ; Apply dark colors when the calendar dropdown opens
                    _WinAPI_SetWindowTheme($iCtrl, "", "")
                    Local $iCtrl = _GUICtrlDTP_GetMonthCal($hWndFrom)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TEXT,         $COLOR_TEXT_LIGHT)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLEBK,      $COLOR_BG_DARK)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLETEXT,    $COLOR_TEXT_LIGHT)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_MONTHBK,      $COLOR_BG_DARK)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TRAILINGTEXT, $COLOR_TEXT_LIGHT)

                Case $DTN_CLOSEUP
                    ; Restore previous theme settings
                    _WinAPI_SetThemeAppProperties($iTheme)
                    ; Reset iTheme setting (not sure if needed?)
                    $iTheme = ""
                    ; Calendar dropdown closed - no action needed

            EndSwitch
    EndSwitch

 

This fixes the problems with the menus being reset to light mode. But the month/calendar drop down sometimes is dark and sometimes now.

Edited by WildByDesign
Posted
14 minutes ago, Nine said:

Ahhhh.  You missed something important.  $iCtrl is set after its window theme.  Switch the 2 statements and you can eliminate the _WinAPI_GetThemeAppProperties.
I think that is the problem.

You are right. I was able to improve it with your suggestion. However, it seems that the timing of removing the theme with _WinAPI_SetThemeAppProperties(0) prior to the opening of the month/cal dropdown is a very sensitive thing in general. It still seems to sometimes show dark, sometimes light. The menus stay dark though which is most important.

It seems that _WinAPI_SetThemeAppProperties(0) is the only trick that works to be able to color the month/cal. Using _WinAPI_SetWindowTheme($iCtrl, "", "") alone to remove the theme from the month/cal is not enough unfortunately.

Posted

So if we just do the regular theme removal on the month/cal control itself like this:

Local $iCtrl = _GUICtrlDTP_GetMonthCal($hWndFrom)
_WinAPI_SetWindowTheme($iCtrl, "", "")
_GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TEXT,         $COLOR_TEXT_LIGHT)
_GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLEBK,      $COLOR_BG_DARK)
_GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLETEXT,    $COLOR_TEXT_LIGHT)
_GUICtrlMonthCal_SetColor($iCtrl, $MCSC_MONTHBK,      $COLOR_BG_DARK)
_GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TRAILINGTEXT, $COLOR_TEXT_LIGHT)

The month/cal drop down looks like this with extra white space:

monthcal.png

However, everything works perfectly with menus and so on. But with _WinAPI_SetThemeAppProperties(0), it has less of the white border but it causes inconsistencies so far.

If we could somehow remove that white border, that would be nice. I'm still trying more ideas.

Posted (edited)

I figured out a solution. The reason for the larger size of the white space is because we are not catching it early enough. We need to catch the SysMonthCal32 control upon creation, but before it becomes visible. In this specific case, there is no need for _WinAPI_SetThemeAppProperties(0).

The only way that I can solve this is with a WinEventHook which I was leaning toward using anyway for specific use cases. For example:

Case $EVENT_OBJECT_CREATE
    If _WinAPI_GetClassName($hWnd) = 'SysMonthCal32' Then
        _WinAPI_SetWindowTheme($hWnd, "", "")
        _GUICtrlMonthCal_SetColor($hWnd, $MCSC_TEXT, 0xFFFFFF)
        _GUICtrlMonthCal_SetColor($hWnd, $MCSC_TITLEBK, 0x202020)
        _GUICtrlMonthCal_SetColor($hWnd, $MCSC_TITLETEXT, 0xFFFFFF)
        _GUICtrlMonthCal_SetColor($hWnd, $MCSC_BACKGROUND, 0x202020)
        _GUICtrlMonthCal_SetColor($hWnd, $MCSC_MONTHBK, 0x202020)
        _GUICtrlMonthCal_SetColor($hWnd, $MCSC_TRAILINGTEXT, 0xFFFFFF)
    EndIf

This removes the theme for the SysMonthCal32 and colors everything properly. No other tricks. No large white space.

Now in comparison, the following:

Case $EVENT_OBJECT_SHOW
    If _WinAPI_GetClassName($hWnd) = 'SysMonthCal32' Then
        _WinAPI_SetWindowTheme($hWnd, "", "")
        _GUICtrlMonthCal_SetColor($hWnd, $MCSC_TEXT, 0xFFFFFF)
        _GUICtrlMonthCal_SetColor($hWnd, $MCSC_TITLEBK, 0x202020)
        _GUICtrlMonthCal_SetColor($hWnd, $MCSC_TITLETEXT, 0xFFFFFF)
        _GUICtrlMonthCal_SetColor($hWnd, $MCSC_BACKGROUND, 0x202020)
        _GUICtrlMonthCal_SetColor($hWnd, $MCSC_MONTHBK, 0x202020)
        _GUICtrlMonthCal_SetColor($hWnd, $MCSC_TRAILINGTEXT, 0xFFFFFF)
    EndIf

This does not work at all. It is too late at this point.

Edited by WildByDesign
Posted (edited)
45 minutes ago, WildByDesign said:

... In this specific case, there is no need for _WinAPI_SetThemeAppProperties(0). ...

not sure about anything because am just browsing, but I saw "_WinAPI_SetThemeAppProperties(0)" and thinking to myself am like "what if I add  a button after ?, the whole gui is w/o theme now ?" and I thought of this:

Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam
    Local Static $iTheme  ; argumentum
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $tBuffer, $tBuffer2, $iCtrl
    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd($tNMHDR.hWndFrom)
    $iIDFrom = $tNMHDR.IDFrom
    $iCode = $tNMHDR.Code

    Switch $hWndFrom
        Case $g_hDate ;thanks to argumentum for the code :-)
            Switch $iCode
                Case $NM_SETFOCUS
                    $iTheme = _WinAPI_GetThemeAppProperties() ; argumentum
                    ; Disable the visual theme when the DateTime control receives focus
                    _WinAPI_SetThemeAppProperties(0)

                Case $DTN_DROPDOWN;, $EVENT_OBJECT_CREATE
                    ; Apply dark colors when the calendar dropdown appears
                    _WinAPI_SetWindowTheme($iCtrl, "", "")
                    Local $iCtrl = _GUICtrlDTP_GetMonthCal($hWndFrom)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TEXT, $GUIDARKMODE_COLOR_GUICTRL)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLEBK, $GUIDARKMODE_COLOR_GUICTRLBK)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TITLETEXT, $GUIDARKMODE_COLOR_GUICTRL)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_BACKGROUND, $GUIDARKMODE_COLOR_GUICTRLBK)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_MONTHBK, $GUIDARKMODE_COLOR_GUICTRLBK)
                    _GUICtrlMonthCal_SetColor($iCtrl, $MCSC_TRAILINGTEXT, $GUIDARKMODE_COLOR_GUICTRL)

                Case $NM_KILLFOCUS
                    _WinAPI_SetThemeAppProperties($iTheme)  ; argumentum

                Case $DTN_CLOSEUP
                    ; Calendar will closed

            EndSwitch
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc  ;==>WM_NOTIFY

because otherwise we may be introducing a bug.

Edited by argumentum
oops

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

Posted
2 hours ago, argumentum said:

not sure about anything because am just browsing, but I saw "_WinAPI_SetThemeAppProperties(0)" and thinking to myself am like "what if I add  a button after ?, the whole gui is w/o theme now ?" and I thought of this:

This didn't end up working, but it did get me thinking about it some more.

It doesn't work under $NM_KILLFOCUS because that never gets called until you click on another control to bring focus there. For example, if you open the calendar and then click anywhere in the GUI background, the calendar will close but it will not call $NM_KILLFOCUS still.

Placing it under $DTN_CLOSEUP seems to work the best. And when I use your updated code, but place under $DTN_CLOSEUP, the calendar is working 100% which is good. No more "sometimes light, sometimes dark". All good. Thank you. :)

Posted (edited)
10 hours ago, WildByDesign said:

Thanks to @Nine's details, I have discovered a bug but I need help to fix it properly. The bug is affecting GUIDarkTheme and also @UEZ's SampleControls.au3 in Dark Mode.

I cannot reproduce the issue on my system. It displays as intended in the correct size and in dark mode.

Edited 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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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...