ISI360 Posted August 23, 2018 Share Posted August 23, 2018 Hi! I currently have probelms trying to create a vertical toolbar with a rebar. The Controls create and works fine...until i change some state of it. Then it will mess up everything when the mouse is moving over the buttons. Please can someone explain me what i´m doing wrong here?? expandcollapse popup#include <Constants.au3> #include <GuiButton.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <GuiImageList.au3> #include <GuiReBar.au3> #include <GuiToolbar.au3> #include <WindowsConstants.au3> Global $hGui, $hGui2, $hReBar, $aStrings[5] Global Enum $Hruntest = 1000, $Hconfig, $hDisplayCSV, $H_netmon, $H_graphdisplay, $H_netmon1 $hGui = GUICreate("Rebar", 900, 396, 400, 200, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX)) $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 55) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 130) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 154) Global $hToolbar = _GUICtrlToolbar_Create($hGui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN, $TBSTYLE_WRAPABLE) ) _GUICtrlToolbar_SetImageList($hToolbar, $hImage) _GUICtrlToolbar_AddButton($hToolbar, $Hruntest, 0, 0,BitOR($BTNS_DROPDOWN, $BTNS_WHOLEDROPDOWN)) _GUICtrlToolbar_AddButton($hToolbar, $Hconfig, 1, 1 ) _GUICtrlToolbar_AddButton($hToolbar, $hDisplayCSV, 2, 2) _GUICtrlToolbar_AddButton($hToolbar, $H_graphdisplay, 3, 3) _GUICtrlToolbar_AddButton($hToolbar, $H_netmon, 4, 4) _GUICtrlToolbar_AddButton($hToolbar, $H_netmon1, 5, 5) $hReBar = _GUICtrlRebar_Create($hGui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $CCS_VERT, $RBS_FIXEDORDER )) _GUICtrlToolbar_SetButtonSize($hToolbar, 30 , 22 ) _GUICtrlRebar_AddToolBarBand($hReBar, $hToolbar, "", -1, $RBBS_NOGRIPPER ) GUISetState(@SW_SHOW) MsgBox(0,"Demo","At the moment everything is ok. The vertical toolbar is created and works with no problems!"&@crlf&@crlf&"But now let us disable for example the first button...",0,$hGui) _GUICtrlToolbar_SetButtonState($hToolbar, $Hruntest, $TBSTATE_INDETERMINATE ) MsgBox(0,"Demo","...and now it´s getting buggy! :P"&@crlf&"Move the mouse over the buttons and see yourselfe... (after closing this dialog)",0,$hGui) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Thanks in advance! Link to comment Share on other sites More sharing options...
Deye Posted August 23, 2018 Share Posted August 23, 2018 Hi ISI360, The $BTNS_*DROPDOWN is actually another hidden button that remains on the same level of the other buttons With the Enumeration enabled it gets shuffled inside with the other buttons, as you can see using this: Quote _GUICtrlToolbar_SetButtonState($hToolbar, $Hruntest, $TBSTATE_INDETERMINATE) _GUICtrlToolbar_SetButtonStyle($hToolbar, $Hruntest, $BTNS_NOPREFIX) Deye Link to comment Share on other sites More sharing options...
ISI360 Posted August 23, 2018 Author Share Posted August 23, 2018 Hi Deye Hmm i don´t think it has to do with the dropdown. If i convert the dropdown to a normal button (like the other ones) the effect is the same. Or missunderstand i something? Link to comment Share on other sites More sharing options...
Deye Posted August 23, 2018 Share Posted August 23, 2018 this overrides the bug : doesn't it ? _GUICtrlToolbar_SetButtonState($hToolbar, $Hruntest, $TBSTATE_INDETERMINATE) _GUICtrlToolbar_SetButtonStyle($hToolbar, $Hruntest, $BTNS_NOPREFIX) _GUICtrlToolbar_SetButtonStyle($hToolbar, $Hruntest, $BTNS_WHOLEDROPDOWN) Deye Link to comment Share on other sites More sharing options...
ISI360 Posted August 23, 2018 Author Share Posted August 23, 2018 Yes..and no. The mouse hoover effect is gone with $BTNS_WHOLEDROPDOWN. But it removes the secound button with that ^^ Same effect on buttons without a dropdown... expandcollapse popup#include <Constants.au3> #include <GuiButton.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <GuiImageList.au3> #include <GuiReBar.au3> #include <GuiToolbar.au3> #include <WindowsConstants.au3> Global $hGui, $hGui2, $hReBar, $aStrings[5] Global Enum $Hruntest = 1000, $Hconfig, $hDisplayCSV, $H_netmon, $H_graphdisplay, $H_netmon1 $hGui = GUICreate("Rebar", 900, 396, 400, 200, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX)) $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 55) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 130) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 154) Global $hToolbar = _GUICtrlToolbar_Create($hGui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN, $TBSTYLE_WRAPABLE) ) _GUICtrlToolbar_SetImageList($hToolbar, $hImage) _GUICtrlToolbar_AddButton($hToolbar, $Hruntest, 0, 0,BitOR($BTNS_DROPDOWN, $BTNS_WHOLEDROPDOWN)) _GUICtrlToolbar_AddButton($hToolbar, $Hconfig, 1, 1 ) _GUICtrlToolbar_AddButton($hToolbar, $hDisplayCSV, 2, 2) _GUICtrlToolbar_AddButton($hToolbar, $H_graphdisplay, 3, 3) _GUICtrlToolbar_AddButton($hToolbar, $H_netmon, 4, 4) _GUICtrlToolbar_AddButton($hToolbar, $H_netmon1, 5, 5) $hReBar = _GUICtrlRebar_Create($hGui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $CCS_VERT, $RBS_FIXEDORDER )) _GUICtrlToolbar_SetButtonSize($hToolbar, 30 , 22 ) _GUICtrlRebar_AddToolBarBand($hReBar, $hToolbar, "", -1, $RBBS_NOGRIPPER ) GUISetState(@SW_SHOW) MsgBox(0,"Demo","At the moment everything is ok. The vertical toolbar is created and works with no problems!"&@crlf&@crlf&"But now let us disable for example the first button...",0,$hGui) _GUICtrlToolbar_SetButtonState($hToolbar, $Hruntest, $TBSTATE_INDETERMINATE) _GUICtrlToolbar_SetButtonStyle($hToolbar, $Hruntest, $BTNS_NOPREFIX) _GUICtrlToolbar_SetButtonStyle($hToolbar, $Hruntest, $BTNS_WHOLEDROPDOWN) MsgBox(0,"Demo","...works..but the secound button is gone :(. Lets disable the butterfly button.",0,$hGui) _GUICtrlToolbar_SetButtonState($hToolbar, $H_graphdisplay, $TBSTATE_INDETERMINATE) MsgBox(0,"Demo","...and its buggy again :(",0,$hGui) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
LarsJ Posted August 23, 2018 Share Posted August 23, 2018 In code in first post replace this: _GUICtrlToolbar_SetButtonState($hToolbar, $Hruntest, $TBSTATE_INDETERMINATE ) with this: _GUICtrlToolbar_SetButtonState($hToolbar, $Hruntest, _GUICtrlToolbar_GetButtonState( $hToolbar, $Hruntest) - $TBSTATE_ENABLED ) 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...
ISI360 Posted August 23, 2018 Author Share Posted August 23, 2018 Thank you very very much LarsJ! Works like a charm! Really looks the $TBSTATE_INDETERMINATE alone destorys something in the button state. Link to comment Share on other sites More sharing options...
LarsJ Posted August 23, 2018 Share Posted August 23, 2018 You should always use this method. Normally, you cannot replace all existing states with a single new state. 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...
ISI360 Posted August 23, 2018 Author Share Posted August 23, 2018 Will be done, thanks again 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