Jump to content

Recommended Posts

Posted (edited)

GUIDarkTheme 2.6.0

  • Improved Toolbar subclassing significantly
    • Implemented rounded toolbar buttons
    • Still no Rebar control subclassing yet (W.I.P.)
  • Created SampleControls-Demo2.au3 for demo of dark mode toolbar
    • Combined Statusbar-Demo.au3 into SampleControls-Demo2.au3
  • Cleaned up and reorganized Include files - thanks to @argumentum
  • Updated and improved the Dark Mode API (GUIDarkAPI.au3)
    • It can probably be used on its own now separately from project
Edited by WildByDesign
Posted

GUIDarkTheme 2.7.0

  • Improved the handling of transparent toolbars
    • Added new function _GUIDarkTheme_ToolbarSetTrans to enable/disable transparency
    • Added button to SampleControls-Demo2 for testing _GUIDarkTheme_ToolbarSetTrans
  • Added initial dark mode support for Rebar controls
    • Added new internal function __GUIDarkTheme_SetBandColor for Rebar band coloring - thanks to Nine
      • This removes the need to subclass the Rebar control
  • Improved handling of WM_CTLCOLOR* messages
  • Sorted function lists alphabetically
  • Pass GUI handle instead of using Global variable
    • This is important in situations with multiple GUIs
  • Added checks to __GUIDarkTheme_WM_SIZE to ensure sizebox exists and confirm GUI
  • Miscellaneous bugfixes

While I have added initial dark mode support for Rebar controls, I am not quite ready to add Rebar controls to the SampleControls-Demo2.au3 script. I still have a few more fixes that I need to add for Rebar, but in general it is working quite well.

Rebar dark mode support got some important help from @Nine and @pixelsearch who made it much better. :)

I'm going to share a test script below if you want to test Rebar in GUIDarkTheme UDF. Please keep in mind that there is a crash regarding the DateProc (DateTimePicker) subclassing when you click on one of the rebar bands that changes the size of the DTP control. I have to address that crash.

Rebar testing script:

Spoiler
#include <GuiComboBox.au3>
#include <GuiEdit.au3>
#include "GUIDarkTheme.au3"

; Initialize System DPI awareness
DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)

Example()

Func Example()
    Local $hGui = GUICreate("Rebar Create (v" & @AutoItVersion & ")", 400, 396, -1, -1, $WS_OVERLAPPEDWINDOW)

    ; create the rebar control
    Local $g_hReBar = _GUICtrlRebar_Create($hGui, BitOR($CCS_TOP, $RBS_VARHEIGHT))

    ; create a toolbar to put in the rebar
    Local $hToolbar = _GUICtrlToolbar_Create($hGui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

    ; Add standard system bitmaps
    _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

    ; Add strings
    Local $aStrings[4]
    $aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New")
    $aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open")
    $aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save")
    $aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help")

    ; Add buttons
    Local Enum $e_idNew = 1000, $e_idOpen, $e_idSave, $e_idHelp
    _GUICtrlToolbar_AddButton($hToolbar, $e_idNew, $STD_FILENEW, $aStrings[0])
    _GUICtrlToolbar_AddButton($hToolbar, $e_idOpen, $STD_FILEOPEN, $aStrings[1])
    _GUICtrlToolbar_AddButton($hToolbar, $e_idSave, $STD_FILESAVE, $aStrings[2], $BTNS_CHECK)
    _GUICtrlToolbar_AddButtonSep($hToolbar)
    _GUICtrlToolbar_AddButton($hToolbar, $e_idHelp, $STD_HELP, $aStrings[3])

    ; create a combobox to put in the rebar
    Local $hCombo = _GUICtrlComboBox_Create($hGui, "", 0, 0, 120)

    _GUICtrlComboBox_BeginUpdate($hCombo)
    _GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
    _GUICtrlComboBox_EndUpdate($hCombo)

    ; create a date time picker to put in the rebar
    Local $hDTP = _GUICtrlDTP_Create($hGui, 0, 0, 190)

    ; create a input box to put in the rebar
    Local $hInput = _GUICtrlEdit_Create($hGui, "Input control", 0, 0, 120, 20, 0)

    ; add band with control
    _GUICtrlRebar_AddBand($g_hReBar, $hCombo, 120, 200, "Dir *.exe")

    ; add band with date time picker
    _GUICtrlRebar_AddBand($g_hReBar, $hDTP, 120)

    ; add band with toolbar to beginning of rebar
    _GUICtrlRebar_AddToolBarBand($g_hReBar, $hToolbar, "", 0)

    ;add another control
    _GUICtrlRebar_AddBand($g_hReBar, $hInput, 120, 200, "Name:")

    _GUIDarkTheme_ApplyDark($hGui)
    GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                Exit
        EndSwitch
    WEnd
EndFunc   ;==>Example

 

 

Posted

I finally mastered subclassing the GUI itself (in my local testing script) with SetWindowSubclass() for busy messages such as WM_SIZE and WM_NOTIFY. I had previously failed at this multiple times before. So I was happy about the success.

But very quickly, I realized that the performance of SetWindowSubclass() is nowhere near the performance of GUIRegisterMsg(). At least when it comes to busy messages such as WM_SIZE and WM_NOTIFY.

But it seems the great @LarsJ had already pointed this out half a decade ago in this post:

Quote

If the same subclassing is performed with GUIRegisterMsg(), GUIRegisterMsg20() and SetWindowSubclass() then the message filtering speed will be this (fastest first): GUIRegisterMsg(), SetWindowSubclass() and GUIRegisterMsg20().

GUIRegisterMsg() is fastest because message filtering is done in internal compiled code.

Clearly, I still need to use SetWindowSubclass() for individual controls. However, for subclassing the GUI itself, I am definitely sticking with GUIRegisterMsg() for obvious performance reasons.

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