Jump to content

Recommended Posts

Posted
1 hour ago, WildByDesign said:

According to help file, default is $CCS_TOP, $RBS_VARHEIGHT

You're right, the help file should be amended, here is what it stipulates :

Function Reference
_GUICtrlRebar_Create
Create a Rebar control

#include <GuiReBar.au3>
_GUICtrlRebar_Create ( $hWnd [, $iStyles = 0x513] )
...
Default styles: $CCS_TOP, $RBS_VARHEIGHT
Forced styles: $WS_CHILD, $WS_VISIBLE, $WS_CLIPCHILDREN, $WS_CLIPSIBLINGS

As you noticed, 0x513 doesn't correspond at all to BitOr($CCS_TOP, $RBS_VARHEIGHT), that's why the help file should be amended, because the default styles indicated in the help file doesn't equal 0x513

In fact, if we create a rebar control without indicating any style, it is created... at the bottom of the Gui with the following styles :

Local $hReBar = _GUICtrlRebar_Create($hGUI)

Control Viewer => 0x56000513 = CCS_BOTTOM, CCS_NOHILITE, RBS_TOOLTIPS, RBS_BANDBORDERS, WS_CHILD, WS_VISIBLE, WS_CLIPSIBLINGS, WS_CLIPCHILDREN

[0x40000000, 'WS_CHILD'], _
[0x10000000, 'WS_VISIBLE'], _
[0x04000000, 'WS_CLIPSIBLINGS'], _
[0x02000000, 'WS_CLIPCHILDREN'], _

[0x0400, 'RBS_BANDBORDERS'], _
[0x0100, 'RBS_TOOLTIPS']]
[0x0010, 'CCS_NOHILITE'], _
[0x0003, 'CCS_BOTTOM'], _

0x513 seems to correspond to BitOr($RBS_BANDBORDERS, $RBS_TOOLTIPS, $CCS_NOHILITE, $CCS_BOTTOM)

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted
18 minutes ago, pixelsearch said:

In fact, if we create a rebar control without indicating any style, it is created... at the bottom of the Gui with the following styles :

I noticed this as well. Many users would likely run it without the extra parameters with the assumption of getting default values.

I started to realize that maybe I am the only one to create a Rebar control in the last decade. 🤣

Posted
3 hours ago, WildByDesign said:

I'm not sure if this is the right place to report a bug with a function from the standard UDFs, but I've got a bug in _GUICtrlRebar_Create.

;Func _GUICtrlRebar_Create($hWnd, $iStyles = 0x513)
Func _GUICtrlRebar_Create($hWnd, $iStyles = BitOR($CCS_TOP, $RBS_VARHEIGHT))
    Local Const $ICC_BAR_CLASSES = 0x00000004 ; toolbar
    Local Const $ICC_COOL_CLASSES = 0x00000400 ; rebar

    Local $iStyle = BitOR($__GUICTRLCONSTANT_WS_CHILD, $__GUICTRLCONSTANT_WS_VISIBLE, $__REBARCONSTANT_WS_CLIPCHILDREN, $__REBARCONSTANT_WS_CLIPSIBLINGS)
    If $iStyles <> BitOR($__REBARCONSTANT_CCS_TOP, $RBS_VARHEIGHT) Then
        $iStyle = BitOR($iStyle, $iStyles)
    Else
        $iStyle = BitOR($iStyle, $__REBARCONSTANT_CCS_TOP, $RBS_VARHEIGHT)
    EndIf

    Local $tICCE = DllStructCreate('dword;dword')
    DllStructSetData($tICCE, 1, DllStructGetSize($tICCE))
    DllStructSetData($tICCE, 2, BitOR($ICC_BAR_CLASSES, $ICC_COOL_CLASSES))

    Local $aCall = DllCall('comctl32.dll', 'int', 'InitCommonControlsEx', 'struct*', $tICCE)
    If @error Then Return SetError(@error, @extended, 0)
    If $aCall[0] = 0 Then Return SetError(-2, 0, 0)

    Local $nCtrlID = __GuiCtrl_GetNextGlobalID($hWnd)
    If @error Then Return SetError(@error, @extended, 0)

    Local $hReBar = _WinAPI_CreateWindowEx(0, $__REBARCONSTANT_ClassName, "", $iStyle, 0, 0, 0, 0, $hWnd, $nCtrlID)
    If @error Then Return SetError(-1, -1, 0)

    Return $hReBar
EndFunc   ;==>_GUICtrlRebar_Create

According to help file, default is $CCS_TOP, $RBS_VARHEIGHT

Notice how the original Func line (commented out) has 0x513 as default. Well, I'm guessing that does not equal the BitOR for those two values. I added the Func line below that with the BitOR and that seems to go through the function properly and work as intended.

true never change since 2007 introduction

Posted
4 hours ago, WildByDesign said:

I'm not sure if this is the right place to report a bug with a function from the standard UDFs,

Yes and no. autoit-technical-discussion is the right place.
This thread is for the help file.
To add an issue with a standard function, you'd open a new thread here in autoit-technical-discussion named something like: "_GUICtrlRebar_Create() don't work like it used to 😢" ( Or something like that 😅 )
..because as you can see, as we start going down the rabbit's hole, we take over the thread :) 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting  image.gif.922e3a93535f431de08b31ee669cc446.gif
autoit_scripter_blue_userbar.png

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
×
×
  • Create New...