Jump to content
Sign in to follow this  

[SOLVED]resizing a rebar

Recommended Posts


How do I resize a Rebar control, better if dynamically

I have tried pretty much all the techniques in the helpfile for resizing a control to no avail, and I searched the forum for resizing a rebar control and I am almost about to abandon the idea of resizing my gui, as I need the rebar badly.

This is taken from the helpfile for the creation of a rebar control, and I added a statusbar for resizing the gui. As I resize the gui the rebar stay fixed in their last position (even in I set GUICtrlSetResizing)

Thanks for any halp


#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <GuiComboBox.au3>
#include <GuiDateTimePicker.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $hgui, $hReBar, $hStatus


Func _Main()
    Local $hgui, $btnExit, $hToolbar, $hCombo, $hDTP, $hInput
    Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp
    Local $aParts[3] = [75, 150, -1]

    $hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))
    $hStatus = _GUICtrlStatusBar_Create($hgui)
    _GUICtrlStatusBar_SetParts($hStatus, $aParts)
; create the rebar control

; create a toolbar to put in the rebar
    $hToolbar = _GUICtrlToolbar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))
; Add standard system bitmaps
    Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
        Case 0
            _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
        Case 2
            _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_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)

; create a combobox to put in the rebar
    $hCombo = _GUICtrlComboBox_Create($hgui, "", 0, 0, 120)
    _GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
; create a date time picker to put in the rebar
    $hDTP = _GUICtrlDTP_Create($hgui, 0, 0, 190)
; create a input box to put in the rebar
    $hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

; default for add is append
; add band with control
    _GUICtrlRebar_AddBand($hReBar, $hCombo, 120, 200, "Dir *.exe")

; add band with date time picker
    _GUICtrlRebar_AddBand($hReBar, $hDTP, 120)
; add band with toolbar to begining of rebar
    _GUICtrlRebar_AddToolBarBand($hReBar, $hToolbar, "", 0)
;add another control
    _GUICtrlRebar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

    $btnExit = GUICtrlCreateButton("Exit", 150, 340, 100, 25)
    GUIRegisterMsg($WM_SIZE, 'WM_SIZE')

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $btnExit
EndFunc ;==>_Main

Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
Edited by ivan

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.