Yaerox Posted August 10, 2019 Share Posted August 10, 2019 Hey everyone. Is there an option to get a bottom border for the _GUICtrlToolbar? I built a GUI without a Menu just having a Toolbar. I'd like to get a bottom border for the Toolbar to be visible separated from the content. The only thing in my mind right now would be GDIDraw. Any alternatives here? Regards. Link to comment Share on other sites More sharing options...
Nine Posted August 10, 2019 Share Posted August 10, 2019 Maybe providing a snippet of the code you have and have a modified screen shot of what you would like to achieve would facilitate... “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Yaerox Posted August 11, 2019 Author Share Posted August 11, 2019 expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiToolbar.au3> #include <WinAPIConstants.au3> #include <WindowsConstants.au3> Global $g_hToolbar, $g_idMemo Global $g_iItem ; Command identifier of the button associated with the notification. Global Enum $e_idNew = 1000, $e_idOpen, $e_idSave, $e_idHelp Example() Func Example() Local $hGUI, $aSize ; Create GUI $hGUI = GUICreate("Toolbar", 600, 400) $g_hToolbar = _GUICtrlToolbar_Create($hGUI) $aSize = _GUICtrlToolbar_GetMaxSize($g_hToolbar) $g_idMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 20, 596, 396 - ($aSize[1] + 20), $WS_VSCROLL) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") ; Add standard system bitmaps _GUICtrlToolbar_AddBitmap($g_hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) ; Add buttons _GUICtrlToolbar_AddButton($g_hToolbar, $e_idNew, $STD_FILENEW) _GUICtrlToolbar_AddButton($g_hToolbar, $e_idOpen, $STD_FILEOPEN) _GUICtrlToolbar_AddButton($g_hToolbar, $e_idSave, $STD_FILESAVE) _GUICtrlToolbar_AddButtonSep($g_hToolbar) _GUICtrlToolbar_AddButton($g_hToolbar, $e_idHelp, $STD_HELP) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>Example ; Write message to memo Func MemoWrite($sMessage = "") GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite ; WM_NOTIFY event handler Func _WM_NOTIFY($hWndGUI, $iMsgID, $wParam, $lParam) #forceref $hWndGUI, $iMsgID, $wParam Local $tNMHDR, $hWndFrom, $iCode, $iNew, $iFlags, $iOld Local $tNMTBHOTITEM $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $g_hToolbar Switch $iCode Case $NM_LDOWN ;---------------------------------------------------------------------------------------------- MemoWrite("$NM_LDOWN: Clicked Item: " & $g_iItem & " at index: " & _GUICtrlToolbar_CommandToIndex($g_hToolbar, $g_iItem)) ;---------------------------------------------------------------------------------------------- Case $TBN_HOTITEMCHANGE $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam) $iOld = DllStructGetData($tNMTBHOTITEM, "idOld") $iNew = DllStructGetData($tNMTBHOTITEM, "idNew") $g_iItem = $iNew $iFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags") If BitAND($iFlags, $HICF_LEAVING) = $HICF_LEAVING Then MemoWrite("$HICF_LEAVING: " & $iOld) Else Switch $iNew Case $e_idNew ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $e_idNew") ;---------------------------------------------------------------------------------------------- Case $e_idOpen ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $e_idOpen") ;---------------------------------------------------------------------------------------------- Case $e_idSave ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $e_idSave") ;---------------------------------------------------------------------------------------------- Case $e_idHelp ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $idHelp") ;---------------------------------------------------------------------------------------------- EndSwitch EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFY This is the _GUICtrlToolbar_Create Example. So, like you can see in the screenshot, there are 3 Toolbar Buttons, 1 ToolbarSeparator and another Toolbar Button. On the horizontal black line I added with paint, I'd like to have a border styled like a ToolbarSeparator. Link to comment Share on other sites More sharing options...
Nine Posted August 11, 2019 Share Posted August 11, 2019 The easiest way is to use GUICtrlCreateLabel with $SS_SUNKEN style and a black background. Try this : expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiToolbar.au3> #include <WinAPIConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> Global $g_hToolbar, $g_idMemo Global $g_iItem ; Command identifier of the button associated with the notification. Global Enum $e_idNew = 1000, $e_idOpen, $e_idSave, $e_idHelp Example() Func Example() Local $hGUI, $aSize ; Create GUI $hGUI = GUICreate("Toolbar", 600, 400) $g_hToolbar = _GUICtrlToolbar_Create($hGUI) $aSize = _GUICtrlToolbar_GetMaxSize($g_hToolbar) $g_idMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 20, 596, 396 - ($aSize[1] + 20), $WS_VSCROLL) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") ; Add standard system bitmaps _GUICtrlToolbar_AddBitmap($g_hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) ; Add buttons _GUICtrlToolbar_AddButton($g_hToolbar, $e_idNew, $STD_FILENEW) _GUICtrlToolbar_AddButton($g_hToolbar, $e_idOpen, $STD_FILEOPEN) _GUICtrlToolbar_AddButton($g_hToolbar, $e_idSave, $STD_FILESAVE) _GUICtrlToolbar_AddButtonSep($g_hToolbar) _GUICtrlToolbar_AddButton($g_hToolbar, $e_idHelp, $STD_HELP) GUICtrlCreateLabel ("", 5,33,585,6, $SS_SUNKEN) GUICtrlSetBkColor (-1, 0) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>Example ; Write message to memo Func MemoWrite($sMessage = "") GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite ; WM_NOTIFY event handler Func _WM_NOTIFY($hWndGUI, $iMsgID, $wParam, $lParam) #forceref $hWndGUI, $iMsgID, $wParam Local $tNMHDR, $hWndFrom, $iCode, $iNew, $iFlags, $iOld Local $tNMTBHOTITEM $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $g_hToolbar Switch $iCode Case $NM_LDOWN ;---------------------------------------------------------------------------------------------- MemoWrite("$NM_LDOWN: Clicked Item: " & $g_iItem & " at index: " & _GUICtrlToolbar_CommandToIndex($g_hToolbar, $g_iItem)) ;---------------------------------------------------------------------------------------------- Case $TBN_HOTITEMCHANGE $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam) $iOld = DllStructGetData($tNMTBHOTITEM, "idOld") $iNew = DllStructGetData($tNMTBHOTITEM, "idNew") $g_iItem = $iNew $iFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags") If BitAND($iFlags, $HICF_LEAVING) = $HICF_LEAVING Then MemoWrite("$HICF_LEAVING: " & $iOld) Else Switch $iNew Case $e_idNew ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $e_idNew") ;---------------------------------------------------------------------------------------------- Case $e_idOpen ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $e_idOpen") ;---------------------------------------------------------------------------------------------- Case $e_idSave ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $e_idSave") ;---------------------------------------------------------------------------------------------- Case $e_idHelp ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $idHelp") ;---------------------------------------------------------------------------------------------- EndSwitch EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFY Yaerox 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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Yaerox Posted August 12, 2019 Author Share Posted August 12, 2019 On 8/11/2019 at 12:55 PM, Nine said: The easiest way is to use GUICtrlCreateLabel with $SS_SUNKEN style and a black background. Try this : I didn't knew $SS_SUNKEN. Well this seems to be just fine. Thank you! 👍 Link to comment Share on other sites More sharing options...
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