WildByDesign Posted Tuesday at 11:14 AM Author Posted Tuesday at 11:14 AM GUIDarkTheme 2.1.4 Improved separator visibility between tabs in tab control Fixed ListView control border and sizebox measurements Fixed ListBox control border measurements Lowered brightness of UpDown control button borders argumentum and ioa747 2
bladem2003 Posted Tuesday at 06:26 PM Posted Tuesday at 06:26 PM (edited) When a tab is created, the transparent label turns white. #include <StaticConstants.au3> #include "GUIDarkTheme.au3" $hGui = GUICreate("", 300, 200) GUICtrlCreateTab(10, 25, 200, 30) GUICtrlCreateTabItem("tab0") GUICtrlCreateTabItem("tab1") GUICtrlCreateTabItem("tab2") GUICtrlCreateTabItem("") ; end tabitem definition GUICtrlCreateLabel("1111", 10, 100, 100, 20, BitOR($SS_LEFT, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xffffff) _GUIDarkTheme_ApplyDark($hGui) GUISetState() While 1 Sleep(10) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd Edited Tuesday at 06:33 PM by bladem2003
WildByDesign Posted Tuesday at 06:38 PM Author Posted Tuesday at 06:38 PM 10 minutes ago, bladem2003 said: When a tab is created, the transparent label turns white. Thanks for reporting this issue. I will look into this now. I will add detection for $GUI_BKCOLOR_TRANSPARENT and find way to handle it. bladem2003 1
WildByDesign Posted Tuesday at 09:15 PM Author Posted Tuesday at 09:15 PM (edited) @bladem2003 I remembered that I designed the Static controls (labels) to use a NULL_BRUSH by default if no color is specified. Therefore transparent. Try with simply removing the GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) line. #include <StaticConstants.au3> #include "GUIDarkTheme.au3" $hGui = GUICreate("", 300, 200) GUICtrlCreateTab(10, 25, 200, 30) GUICtrlCreateTabItem("tab0") GUICtrlCreateTabItem("tab1") GUICtrlCreateTabItem("tab2") GUICtrlCreateTabItem("") ; end tabitem definition GUICtrlCreateLabel("1111", 10, 100, 100, 20, BitOR($SS_LEFT, $SS_CENTERIMAGE)) ; GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ; try with this line removed GUICtrlSetColor(-1, 0xffffff) _GUIDarkTheme_ApplyDark($hGui) GUISetState() While 1 Sleep(10) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd For Static/label controls, I designed it like this: If no background color is specified, make label background transparent with null brush If user has a background color set, honour the color and set label brush to user set color If label is within a tab control, use tab control background as label brush Please test with code above and see if that is OK. That is the logic that I am using so far for Static/label controls. But it can always be improved if there are problems. Edited Tuesday at 09:17 PM by WildByDesign
bladem2003 Posted Tuesday at 09:32 PM Posted Tuesday at 09:32 PM (edited) Yes, that works, but if I change the background color and then set it back to transparent, the white color reappears. The last version I used was 2.00, and there were no problems with transparency there. Or is there another way to display the label transparently, when I change the background color and then want it to be transparent again? #include <StaticConstants.au3> #include "GUIDarkTheme.au3" $hGui = GUICreate("", 300, 200) GUICtrlCreateTab(10, 25, 200, 30) GUICtrlCreateTabItem("tab0") GUICtrlCreateTabItem("tab1") GUICtrlCreateTabItem("tab2") GUICtrlCreateTabItem("") ; end tabitem definition $idLabel = GUICtrlCreateLabel("1111", 10, 100, 100, 20, BitOR($SS_LEFT, $SS_CENTERIMAGE)) ;GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xffffff) _GUIDarkTheme_ApplyDark($hGui) GUISetState() GUICtrlSetBkColor($idLabel, 0xff0000) GUICtrlSetBkColor($idLabel, $GUI_BKCOLOR_TRANSPARENT) While 1 Sleep(10) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd Edited Tuesday at 09:36 PM by bladem2003
WildByDesign Posted Tuesday at 10:32 PM Author Posted Tuesday at 10:32 PM 58 minutes ago, bladem2003 said: Yes, that works, but if I change the background color and then set it back to transparent, the white color reappears. I see exactly what you mean now. 58 minutes ago, bladem2003 said: Or is there another way to display the label transparently, when I change the background color and then want it to be transparent again? I am not quite ready to do a full release. But please try the following (replace __GUIDarkTheme_WM_CTLCOLOR function) : expandcollapse popupFunc __GUIDarkTheme_WM_CTLCOLOR($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hDC = $wParam Local $hCtrl = $lParam Local $hBrush, $hNull Local $sClass = __DM_WinAPI_GetClassName($hCtrl) If $sClass <> "Static" And $sClass <> "Button" Then Return $GUI_RUNDEFMSG Local $iTextColor, $iBkColor, $iBkMode __GUIDarkTheme_GetCtrlColors($hCtrl, $iTextColor, $iBkColor, $iBkMode) Local $sStyles = __GUIDarkTheme_hWnd2Styles($hCtrl) ; leave Static controls with SS_ICON alone If StringInStr($sStyles, "SS_ICON") Then Return $GUI_RUNDEFMSG ; this is needed to retain the original colors set when first swapped in _GUIDarkTheme_GUICtrlSetDarkTheme __DM_WinAPI_SetTextColor($hDC, __DM_ColorToCOLORREF($iTextColor)) __DM_WinAPI_SetBkMode($hDC, $TRANSPARENT) Local $hTabControl = __DM_WinAPI_FindWindowEx($hWnd, "SysTabControl32") If $hTabControl Then If __GUIDarkTheme_IsCtrlInTab($hTabControl, $hCtrl) Then $hBrush = $__DM_g_hBrushCtrl Return $hBrush Else If $sClass = "Button" Then Return $GUI_RUNDEFMSG Switch $iBkColor Case $__DM_g_iCtrlBkColor ; transparent background $hNull = __DM_WinAPI_GetStockObject($NULL_BRUSH) If $hNull Then Return $hNull ; Fallback if not available: Return $GUI_RUNDEFMSG Case $__DM_g_iGuiBkColor ; transparent background $hNull = __DM_WinAPI_GetStockObject($NULL_BRUSH) If $hNull Then Return $hNull ; Fallback if not available: Return $GUI_RUNDEFMSG Case 0xFFFFFF ; transparent background $hNull = __DM_WinAPI_GetStockObject($NULL_BRUSH) If $hNull Then Return $hNull ; Fallback if not available: Return $GUI_RUNDEFMSG Case Else ; return same color brush when user set custom background color (eg. 0x00FF00) $hBrush = __DM_WinAPI_CreateSolidBrush(__DM_ColorToCOLORREF($iBkColor)) Return $hBrush EndSwitch EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>__GUIDarkTheme_WM_CTLCOLOR Please let me know if that is working. bladem2003 1
xuankhanh1982 Posted Wednesday at 12:16 AM Posted Wednesday at 12:16 AM (edited) expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GUIDarkTheme.au3> Global $g_DpiRatio = _ApplyDpiScaling() a() Func a() $Form1 = GUICreate("Form1", 615*$g_DpiRatio, 437*$g_DpiRatio, -1, -1, $ws_sysmenu) $input = GUICtrlCreateInput(@SystemDir, 65, 5, 340, 20) GUICtrlSetState(-1, 128) $disable_input = GUICtrlCreateButton("Disable Input", 60, 40, 100, 35) $emable_input = GUICtrlCreateButton("Emable Input", 180, 40, 100, 35) $Combo1 = GUICtrlCreateCombo("None", 168, 168, 129, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Combo1|Combo2|Combo3", "Combo1") $Button1 = GUICtrlCreateButton("Button1", 168, 264, 89, 49) $Radio1 = GUICtrlCreateRadio("Radio1", 360, 112, 121, 41) $lb = GUICtrlCreateLabel("Label1", 50, 150, Default, 15) $Group1 = GUICtrlCreateGroup("Group1", 350, 40, 113, 49) GUICtrlCreateGroup("", -99, -99, 1, 1) $Tab1 = GUICtrlCreateTab(352, 240, 153, 80) $TabSheet1 = GUICtrlCreateTabItem("config") $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 360, 270, 100, 15) $TabSheet2 = GUICtrlCreateTabItem("TabSheet1") GUICtrlCreateTabItem("") _GUIDarkTheme_ApplyDark($Form1, True) ;~ _GUIDarkTheme_ApplyLight($Form1) GUICtrlSetBkColor($Combo1, $__DM_g_iCtrlBkColor) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $disable_input GUICtrlSetState($input, 128) Case $emable_input GUICtrlSetState($input, 64) Case $Button1 b() EndSwitch WEnd EndFunc Func b() $Form2 = GUICreate("Form2", 389*$g_DpiRatio, 188*$g_DpiRatio, 192, 124) $Button2 = GUICtrlCreateButton("Button2", 152, 120, 73, 33) $Label2 = GUICtrlCreateLabel("Label2", 104, 48, Default, 15) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 248, 48, 65, 25) $Radio2 = GUICtrlCreateRadio("Radio2", 288, 128, 57, 25) $List2 = GUICtrlCreateList("6556565", 24, 88, 97, 45) _GUIDarkTheme_ApplyDark($Form2, True) ;~ _GUIDarkTheme_ApplyLight($Form2) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 Local $sMsg = "GUIDarkTheme UDF" & @CRLF $sMsg &= "Version: " & @TAB & _GUIDarkTheme_Version() _GUIDarkTheme_MsgBox(64+262144, "About", $sMsg, 0, $Form2) EndSwitch WEnd EndFunc Func _ApplyDpiScaling() Local Const $DPI_AWARENESS_CONTEXT_SYSTEM_AWARE = - 2 __DM_WinAPI_SetProcessDpiAwarenessContext($DPI_AWARENESS_CONTEXT_SYSTEM_AWARE) Local $iDPI = Round(__DM_WinAPI_GetDpiFromDpiAwarenessContext($DPI_AWARENESS_CONTEXT_SYSTEM_AWARE)/96, 2) If @error Then $iDPI = 1 Return $iDPI EndFunc ;==>_ApplyDpiScaling @bladem2003 Can you re-upload version 2.0.0? @WildByDesign When I click the "GUICtrlCreateCombo" button, the background color doesn't match the dark theme Edited Wednesday at 12:55 AM by xuankhanh1982 argumentum and WildByDesign 2
WildByDesign Posted Wednesday at 01:42 AM Author Posted Wednesday at 01:42 AM 1 hour ago, xuankhanh1982 said: When I click the "GUICtrlCreateCombo" button, the background color doesn't match the dark theme Thank you for reporting this bug. I just fixed it locally. I will update a new release in the morning. argumentum 1
WildByDesign Posted Wednesday at 02:35 AM Author Posted Wednesday at 02:35 AM (edited) GUIDarkTheme 2.2.0 Removed subclassing for $WM_CTLCOLORSTATIC messages Handling Static (label) controls without subclassing now Switched many larger If statements to use Ternary instead Fixed issue when $GUI_BKCOLOR_TRANSPARENT is used as label background color Fixed regression with ComboBox drop-down not showing dark mode Fixed some tab control compatibility issues with various controls Script breaking changes in 2.2.0: Primary functions to initiate GUIDarkTheme UDF now only use one parameter (GUI handle) _GUIDarkTheme_ApplyAuto, _GUIDarkTheme_ApplyDark, _GUIDarkTheme_ApplyLight only need GUI handle as param Many other (internal) functions have been simplified as well Removed support for applying Windows 11 materials (eg. Mica) I am not a big fan of making any script breaking changes. But GUIDarkTheme UDF was getting too complex and I lost my own focus by adding a poor implementation of Windows 11 materials and so on. Many of the functions that initiate GUIDarkTheme UDF ended up having four (4) or more parameters which was confusing and silly. Now, they simply use one parameter which is the GUI handle. The UDF itself determines the best control theming to use based on the operating system build detected. GUIDarkTheme UDF is "lean and mean" once again (pun on WIN32_LEAN_AND_MEAN) and the only focus is being the best dark theme (and light) possible and making that automatic switch as smooth as possible. I apologize for making these script breaking changes. I put a lot of thought into it and I sincerely believe that it will be much better for the long term of this UDF and will be worth it. Especially for anyone who uses GUIDarkTheme UDF for the first time. Having said all of that, this release really is "lean and mean". Lots of bugs fixed and removed some unneeded subclassing which has now improved the overall performance of the existing subclassing. Edited Wednesday at 02:36 AM by WildByDesign bladem2003 and argumentum 2
xuankhanh1982 Posted Wednesday at 04:22 AM Posted Wednesday at 04:22 AM @WildByDesign How do I change the color of "GUICtrlCreateProgress" back to the default Windows blue in dark mode?
WildByDesign Posted Wednesday at 09:13 AM Author Posted Wednesday at 09:13 AM 4 hours ago, xuankhanh1982 said: How do I change the color of "GUICtrlCreateProgress" back to the default Windows blue in dark mode? If you want to enforce the original Windows progress style: __DM_WinAPI_SetWindowTheme(GUICtrlGetHandle($idProgress), 'DarkMode', 'Progress') That would need to be added after you initiate GUIDarkTheme UDF (for example): _GUIDarkTheme_ApplyDark($hGUI) __DM_WinAPI_SetWindowTheme(GUICtrlGetHandle($idProgress), 'DarkMode', 'Progress') xuankhanh1982 1
xuankhanh1982 Posted Wednesday at 02:53 PM Posted Wednesday at 02:53 PM @WildByDesign Thanks WildByDesign 1
WildByDesign Posted Friday at 01:04 PM Author Posted Friday at 01:04 PM GUIDarkTheme 2.3.0 Added separate background color brush for tab controls Allows improved contrast between tab control and controls within it Improved Static control coloring logic Improves initial coloring and coloring during theme changes Tab control compatibility improvements Fixed issue with frame showing around button within tab control Fixed issue with Group control (BS_GROUPBOX) incorrect background color within tab control I spent the last few days working almost entirely on Tab Controls in general and Static control logic which was also an important role in Tab Controls. So this update is for Tab Control lovers. I ended up spending way too many hours on the Group control (BS_GROUPBOX) issue within the tab control. I ended up having to learn the entire under-the-hood workings of Group controls before I could eventually fix it. You can now use Group controls within the Tab controls peacefully. In the SampleControls-Demo script, I added a button on "Tab Three" and a Group control on "Tab Four" just to show that those are working properly now. If anyone does not like the new background color for Tab controls, the good thing is that you can change that easily if you need to. Change: Global $__DM_g_iTabCtrlBkColor, $__DM_g_iTabCtrlBkColorDark = 0x191919, $__DM_g_iTabCtrlBkColorLight = 0xFFFFFF To: Global $__DM_g_iTabCtrlBkColor, $__DM_g_iTabCtrlBkColorDark = 0x202020, $__DM_g_iTabCtrlBkColorLight = 0xF4F4F4 That is only if you want to restore the original Tab control background colors. bladem2003, argumentum and mLipok 2 1
jpm Posted Saturday at 08:20 AM Posted Saturday at 08:20 AM Tab four is not showing properly the sample group doe not show in dark mode switching to light mode and back show it small remark var naming does not follow recommendation as $left must be $iLeft you are doing an awesome work WildByDesign 1
WildByDesign Posted Saturday at 11:47 AM Author Posted Saturday at 11:47 AM 3 hours ago, jpm said: Tab four is not showing properly the sample group doe not show in dark mode switching to light mode and back show it I can reproduce this issue. Thank you for reporting. I am working on the Button (group, checkbox, radio, etc.) logic right now and will have a fix in the next release. 3 hours ago, jpm said: small remark var naming does not follow recommendation as $left must be $iLeft The TabProc function already has conflicting measurement variables for another part of the tab function. To avoid conflict, I can add "CR" at the end which would refer to "client rect" since that is what these are for: Local $iLeftCR, $iTopCR, $iRightCR, $iBottomCR Is this variable naming OK? 3 hours ago, jpm said: you are doing an awesome work Thank you. That means a lot to me.
WildByDesign Posted Saturday at 01:12 PM Author Posted Saturday at 01:12 PM GUIDarkTheme 2.3.1 Tab control compatibility improvements Fixed issue with Group control not showing dark mode on Win10/11 builds less than 26100.6899 New implementation for the logic regarding Button (group, checkbox, radio, etc.) behavior in tabs 4 hours ago, jpm said: Tab four is not showing properly the sample group doe not show in dark mode switching to light mode and back show it Can you please test version 2.3.1 and let me know if the issue is resolved? Thank you. argumentum 1
jpm Posted Saturday at 03:12 PM Posted Saturday at 03:12 PM The group is not showing switching to tab fic)ve and back to four sometime show same pb with light theme
bladem2003 Posted Saturday at 05:05 PM Posted Saturday at 05:05 PM Hi @WildByDesign Can we display a dark message box before the graphical user interface is created? #include "GUIDarkTheme.au3" _GUIDarkTheme_MsgBox(262144 + 0 + 32, "test", "test") ; <--------- this $hGui = GUICreate("", 300, 200) _GUIDarkTheme_ApplyDark($hGui) GUISetState() _GUIDarkTheme_MsgBox(262144 + 0 + 32, "test", "test") While 1 Sleep(10) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd
WildByDesign Posted Saturday at 09:13 PM Author Posted Saturday at 09:13 PM 4 hours ago, bladem2003 said: Can we display a dark message box before the graphical user interface is created? This is an interesting issue. Thanks for finding this bug. And yes, we definitely should be able to display a dark MsgBox before GUI. The problem here is that the brushes are not loaded yet. I will have this fixed for the next release soon. I think what I will do in this case is simply load the brushes locally for the dark MsgBox stuff. This way it can be used without GUI. bladem2003 1
mLipok Posted Saturday at 10:03 PM Posted Saturday at 10:03 PM (edited) @WildByDesign Try change theme for the secret hidden window created automaticaly by AutoIt. Edited Saturday at 10:04 PM by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
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