Jump to content

Vertical Rebar Bug?


 Share

Recommended Posts

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

#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

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

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

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

#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

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 )

 

Link to comment
Share on other sites

You should always use this method. Normally, you cannot replace all existing states with a single new state.

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...