WildByDesign Posted 7 hours ago Posted 7 hours ago I've been doing some work on Toolbar controls recently for GUIDarkTheme UDF and realized that toolbars created with _GUICtrlToolbar_Create are transparent by default. I need to program GUIDarkTheme UDF to handle this and act accordingly. Getting that value is not a problem. But my question is: Is transparent toolbar by default the expected behaviour? Or is that a bug? The default style that is set is $TBSTYLE_FLAT, not $TBSTYLE_TRANSPARENT. Here is the code for the _GUICtrlToolbar_Create function from GuiToolbar.au3: Func _GUICtrlToolbar_Create($hWnd, $iStyle = $TBSTYLE_FLAT, $iExStyle = 0x00000000) $iStyle = BitOR($iStyle, $__GUICTRLCONSTANT_WS_CHILD, $__TOOLBARCONSTANT_WS_CLIPSIBLINGS, $__GUICTRLCONSTANT_WS_VISIBLE) Local $nCtrlID = __GuiCtrl_GetNextGlobalID($hWnd) If @error Then Return SetError(@error, @extended, 0) Local $hTool = _WinAPI_CreateWindowEx($iExStyle, $__TOOLBARCONSTANT_ClassName, "", $iStyle, 0, 0, 0, 0, $hWnd, $nCtrlID) __GUICtrlToolbar_ButtonStructSize($hTool) Return $hTool EndFunc ;==>_GUICtrlToolbar_Create And here is the example from the help file showing transparent toolbar being default: expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiToolbar.au3> #include <MsgBoxConstants.au3> #include <WinAPIConstants.au3> Example() Func Example() Local $hGUI, $hToolbar, $bStyle Local Enum $e_idNew = 1000, $e_idOpen, $e_idSave, $e_idHelp ; Create GUI $hGUI = GUICreate("Toolbar", 400, 300) $hToolbar = _GUICtrlToolbar_Create($hGUI) GUISetBkColor(0xffffff) GUISetState(@SW_SHOW) ; Add standard system bitmaps Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar) Case 0 _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR) Case 2 _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) EndSwitch ; Add buttons _GUICtrlToolbar_AddButton($hToolbar, $e_idNew, $STD_FILENEW) _GUICtrlToolbar_AddButton($hToolbar, $e_idOpen, $STD_FILEOPEN) _GUICtrlToolbar_AddButton($hToolbar, $e_idSave, $STD_FILESAVE) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddButton($hToolbar, $e_idHelp, $STD_HELP) ; Change control style $bStyle = _GUICtrlToolbar_GetStyleTransparent($hToolbar) MsgBox($MB_SYSTEMMODAL, "Information", "Toolbar has transparent style .: " & $bStyle) GUISetState(@SW_LOCK) _GUICtrlToolbar_SetStyleTransparent($hToolbar, Not $bStyle) GUISetState(@SW_UNLOCK) MsgBox($MB_SYSTEMMODAL, "Information", "Toolbar has transparent style .: " & _GUICtrlToolbar_GetStyleTransparent($hToolbar)) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>Example
Nine Posted 6 hours ago Posted 6 hours ago Seems that FLAT also makes it TRANSPARENT : Quote To implement a flat, transparent toolbar, pass TBSTYLE_FLAT (and optionally TBSTYLE_TRANSPARENT) in the CreateWindowEx window styles WildByDesign 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
WildByDesign Posted 6 hours ago Author Posted 6 hours ago 16 minutes ago, Nine said: Seems that FLAT also makes it TRANSPARENT That is interesting. So with FLAT, we must expect transparency. Understandable. But then the question becomes, should FLAT be the default style for a toolbar if a user does not specify? My own personal thought is that, over a long history I am more accustomed to seeing toolbars that are not transparent. Having transparency option is fantastic and important. My concern is more about whether it should be default behaviour from the standard UDF functions.
Nine Posted 6 hours ago Posted 6 hours ago 2 minutes ago, WildByDesign said: more accustomed to seeing toolbars that are not transparent I agree. I would suggest that the toolbar creation function should make it non-transparent. WildByDesign 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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