gcue Posted December 6, 2013 Share Posted December 6, 2013 (edited) hello world! i have a working horizontal toolbar (props to rover and the help file) that i would like to make a vertical sidebar. i dont see how i specify the height, width, coordinates of the toolbar itself.. any ideas? thanks in advance! expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <GuiToolbar.au3> #include <guiimagelist.au3> Opt("GUIOnEventMode", 1) Global $msg_normal = 262144 Global Enum $idDeSelect = 2000, $idRefresh, $idHome, $idOutPutFolder, $idLocationUpdate $dGUI = GUICreate("test", 507, 440) Global $iItem, $iToolbarTextColour Global Const $TBCDRF_USECDCOLORS = 0x00800000 Global Const $tagNMHDR64 = "long_ptr hWndFrom;int_ptr IDFrom;int Code" Global Const $tagNMCUSTOMDRAWINFO = $tagNMHDR & ";dword DrawStage;hwnd HDC;" & _ "int Rect[4];long_ptr ItemSpec;uint ItemState;long_ptr ItemParam" Global Const $tagNMTBCUSTOMDRAW = $tagNMCUSTOMDRAWINFO & ";hwnd hbrMonoDither;" & _ "hwnd hbrLines;hwnd hpenLines;dword clrText;dword clrMark;dword clrTextHighlight;" & _ "dword clrBtnFace;dword clrBtnHighlight;dword clrHighlightHotTrack;int rcText[4];" & _ "int nStringBkMode;int nHLStringBkMode;int iListGap" Global $iTBStyles = BitOR($TBSTYLE_FLAT, $TBSTYLE_TRANSPARENT) $side_toolbar = _GUICtrlToolbar_Create($dGUI, $iTBStyles) $aSize = _GUICtrlToolbar_GetMaxSize($side_toolbar) _GUICtrlToolbar_SetStyleCustomErase($side_toolbar, True) _GUICtrlToolbar_SetExtendedStyle($side_toolbar, $TBSTYLE_EX_DRAWDDARROWS) Switch @OSVersion Case "WIN_XP" DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $side_toolbar, "wstr", "", "wstr", "") Case "WIN_7" DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $side_toolbar, "wstr", "", "wstr", "") EndSwitch $Tbar = GUICtrlCreateDummy() GUICtrlSetOnEvent(-1, "_ToolBar_Click") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") Global $hImage = _GUIImageList_Create(24, 24, 5, 3, 3) ;DeSelect If @OSVersion = "WIN_XP" Then $icon = 65795 If @OSVersion = "WIN_7" Then $icon = 144 _GUIImageList_AddIcon($hImage, "Shell32.dll", $icon, True) ;Refresh If @OSVersion = "WIN_XP" Then $dll = "wmploc.dll" $icon = 719 EndIf If @OSVersion = "WIN_7" Then $dll = "shell32.dll" $icon = 238 EndIf _GUIImageList_AddIcon($hImage, $dll, $icon, True) ;Home If @OSVersion = "WIN_XP" Then $icon = 65795 If @OSVersion = "WIN_7" Then $icon = 150 _GUIImageList_AddIcon($hImage, "shell32.dll", $icon, True) ;Output Folder If @OSVersion = "WIN_XP" Then $dll = "shell32.dll" If @OSVersion = "WIN_7" Then $dll = "imageres.dll" _GUIImageList_AddIcon($hImage, $dll, 4, True) ;Location Update If @OSVersion = "WIN_XP" Then $dll = "wmploc.dll" $icon = 23304 EndIf If @OSVersion = "WIN_7" Then $dll = "imageres.dll" $icon = 162 EndIf _GUIImageList_AddIcon($hImage, $dll, $icon, True) _GUICtrlToolbar_SetImageList($side_toolbar, $hImage) _GUICtrlToolbar_SetImageList($side_toolbar, $hImage) _GUICtrlToolbar_AddButton($side_toolbar, $idDeSelect, 0) _GUICtrlToolbar_AddButton($side_toolbar, $idRefresh, 1) _GUICtrlToolbar_AddButton($side_toolbar, $idHome, 2) _GUICtrlToolbar_AddButton($side_toolbar, $idOutPutFolder, 3) _GUICtrlToolbar_AddButton($side_toolbar, $idLocationUpdate, 4) _GUICtrlToolbar_SetButtonWidth($side_toolbar, 101, 37) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUISetState() While 1 Sleep(10) WEnd Func _ToolBar_Click() Switch GUICtrlRead($Tbar) Case $idDeSelect Debug("DeSelect") Case $idRefresh Debug("Refresh") Case $idHome Debug("Home") Case $idOutPutFolder Debug("OutPutFolder") Case $idLocationUpdate Debug("Location Update") EndSwitch Return EndFunc ;==>_ToolBar_Click Func WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tNMHDR, $hWndFrom, $code, $i_idNew, $idFrom, $i_idOld Local $tNMTBHOTITEM, $hMenu, $aRet, $iMenuID = -1 $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $idFrom = DllStructGetData($tNMHDR, "IDFrom") $code = DllStructGetData($tNMHDR, "Code") Switch $code Case $NM_CLICK Switch $hWndFrom Case $side_toolbar Switch $iItem Case $idDeSelect, $idRefresh, $idHome, $idOutPutFolder, $idLocationUpdate Switch _GUICtrlToolbar_IsButtonEnabled($side_toolbar, $iItem) Case True GUICtrlSendToDummy($Tbar, $iItem) EndSwitch EndSwitch EndSwitch Case $TBN_HOTITEMCHANGE Switch $hWndFrom Case $side_toolbar $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam) $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld") $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew") $iItem = $i_idNew EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func Debug($variable1 = "", $variable2 = "", $variable3 = "") If IsArray($variable1) Then _ArrayDisplay($variable1) Else If $variable2 <> "" Then $variable1 &= @CRLF & $variable2 EndIf If $variable3 <> "" Then $variable1 &= @CRLF & $variable3 EndIf ClipPut($variable1) MsgBox($msg_normal, "Debug", $variable1) EndIf EndFunc ;==>Debug Func _Exit() Exit EndFunc ;==>_Exit Edited December 6, 2013 by gcue Link to comment Share on other sites More sharing options...
Terenz Posted December 6, 2013 Share Posted December 6, 2013 For the height-width, in your script, check _GUIImageList_Create(24, 24, 5, 3, 3) Check this for a vertical toolbar: #include <GUIConstantsEx.au3> #include <GuiReBar.au3> #include <GuiToolbar.au3> #include <WindowsConstants.au3> #include <Constants.au3> Local $hgui, $btnExit, $hToolbar, $hReBar, $hInput Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp $hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX)) ; create the rebar control $hReBar = _GUICtrlRebar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $CCS_VERT)) ; create a toolbar to put in the rebar $hToolbar = _GUICtrlToolbar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN, $TBSTYLE_WRAPABLE)) _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) ; or $IDB_STD_SMALL_COLOR ; Add buttons _GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW) _GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN) _GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE) _GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP) _GUICtrlRebar_AddToolBarBand($hReBar, $hToolbar, "", -1, $RBBS_NOGRIPPER) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
gcue Posted December 6, 2013 Author Share Posted December 6, 2013 For the height-width, in your script, check _GUIImageList_Create(24, 24, 5, 3, 3) yea i thought that too but thats only W x H for each image not the toolbar. thanks for the example though - definitely what i was looking for! have a good weekend =) Link to comment Share on other sites More sharing options...
gcue Posted December 6, 2013 Author Share Posted December 6, 2013 in the vertical example above, how can i specify x,y coordinates so it starts midway down the window? thanks again. Link to comment Share on other sites More sharing options...
Terenz Posted December 6, 2013 Share Posted December 6, 2013 For what i know you can't, only set top-left-right Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
LarsJ Posted December 7, 2013 Share Posted December 7, 2013 You can place the rebar in a child window, and this child window you can place anywhere. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions 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