Refresh beim resizen einer Rebar

    • Offizieller Beitrag

    Wenn ich eine Rebar an die Größe der GUI anpasse, dann werden die einzelnen Elemente nicht refresht (siehe Screenshots).
    Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist. Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.
    Wie kann ich das refreshen hinkriegen?

    Spoiler anzeigen
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <GuiReBar.au3>
    #include <GuiToolBar.au3>
    #include <GuiComboBox.au3>
    #include <GuiDateTimePicker.au3>
    #include <WindowsConstants.au3>
    #include <Constants.au3>
    #include <GuiConstantsEx.au3>
    Opt("MustDeclareVars", 1)
    $Debug_RB = False
    Global $hReBar
    GUIRegisterMsg($WM_SIZE, "WM_SIZE")
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
    _main()
    Func _main()
    Local $hgui, $btnExit, $hToolbar, $hCombo, $hDTP, $hInput
    Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp
    $hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $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, $RBS_BANDBORDERS))
    ; 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)
    EndSwitch
    ; Add buttons
    _GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
    _GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
    _GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
    _GUICtrlToolbar_AddButtonSep($hToolbar)
    _GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)
    ; create a combobox to put in the rebar
    $hCombo = _GUICtrlComboBox_Create($hgui, "", 0, 0, 120)
    _GUICtrlComboBox_BeginUpdate($hCombo)
    _GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
    _GUICtrlComboBox_EndUpdate($hCombo)
    ; create a date time picker to put in the rebar
    $hDTP = _GUICtrlDTP_Create($hgui, 0, 0, 190)
    ; 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, 360, 100, 25)
    GUISetState(@SW_SHOW)
    Sleep(1000)
    WinMove($hgui, '', Default, Default, 500)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE, $btnExit
    Exit
    EndSwitch
    WEnd
    EndFunc ;==>_main
    Func WM_SIZE($hWnd)
    Local $wpos
    $wpos = WinGetPos($hWnd)
    ControlMove($hWnd, "", $hReBar, 0, 0, $wpos[2])
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_SIZE
    Func WM_NOTIFY()
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY
    Func _DebugPrint($s_text, $line = @ScriptLineNumber)
    ConsoleWrite( _
    "!===========================================================" & @LF & _
    "+======================================================" & @LF & _
    "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
    "+======================================================" & @LF)
    EndFunc ;==>_DebugPrint

    [/autoit]
    • Offizieller Beitrag

    Das Problem hat sich erledigt!
    Ich konnte es nach langem rumprobieren endlich lösen: $WS_EX_COMPOSITED als ExStyle für das Fenster.

    Spoiler anzeigen
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <GuiReBar.au3>
    #include <GuiToolBar.au3>
    #include <GuiComboBox.au3>
    #include <GuiDateTimePicker.au3>
    #include <WindowsConstants.au3>
    #include <Constants.au3>
    #include <GuiConstantsEx.au3>
    $Debug_RB = False
    Global $hReBar
    GUIRegisterMsg($WM_SIZE, "WM_SIZE")
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
    _main()
    Func _main()
    Local $hgui, $btnExit, $hToolbar, $hCombo, $hDTP, $hInput, $wpos
    Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp
    $hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX), $WS_EX_COMPOSITED)
    ; create the rebar control
    $hReBar = _GUICtrlRebar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))
    ; 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)
    EndSwitch
    ; Add buttons
    _GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
    _GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
    _GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
    _GUICtrlToolbar_AddButtonSep($hToolbar)
    _GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)
    ; create a combobox to put in the rebar
    $hCombo = _GUICtrlComboBox_Create($hgui, "", 0, 0, 120)
    _GUICtrlComboBox_BeginUpdate($hCombo)
    _GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
    _GUICtrlComboBox_EndUpdate($hCombo)
    ; create a date time picker to put in the rebar
    $hDTP = _GUICtrlDTP_Create($hgui, 0, 0, 190)
    ; 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, 360, 100, 25)
    GUISetState(@SW_SHOW)
    Sleep(1000)
    $wpos = WinGetPos($hgui)
    WinMove($hgui, '', Default, Default, 500)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE, $btnExit
    Exit
    EndSwitch
    WEnd
    EndFunc ;==>_main
    Func WM_SIZE($hWnd)
    Local $wpos
    $wpos = WinGetPos($hWnd)
    ControlMove($hWnd, "", $hReBar, 0, 0, $wpos[2])
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_SIZE
    Func WM_NOTIFY()
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY
    Func _DebugPrint($s_text, $line = @ScriptLineNumber)
    ConsoleWrite( _
    "!===========================================================" & @LF & _
    "+======================================================" & @LF & _
    "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
    "+======================================================" & @LF)
    EndFunc ;==>_DebugPrint

    [/autoit]
    • Offizieller Beitrag

    Oscar, ich denke mal dein Script ist von hier: http://www.autoitscript.com/forum/topic/11…-rebar-problem/

    Ich würde auch gern eine Rebar in Win 7 verwenden, kann aber den ExStyle $WS_EX_COMPOSITED nicht verwenden.
    Bei $WS_EX_COMPOSITED flackert meine GUI wie bescheurt und alle Controls werden ständig neu gezeichnet.

    Hat vielleicht noch jemand eine Idee?

  • Das funzt auch bei mir unter Win7 x64 (Beispiel aus dem engl. Forum):

    Spoiler anzeigen
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Outfile=..\..\..\..\PROGRAMDATA\MY Docs\Auto It\Test\rebar_test.exe
    #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <GuiReBar.au3>
    #include <GuiToolBar.au3>
    #include <GuiComboBox.au3>
    #include <GuiDateTimePicker.au3>
    #include <WindowsConstants.au3>
    #include <Constants.au3>
    #include <GuiConstantsEx.au3>
    Opt("MustDeclareVars", 1)
    $Debug_RB = False
    Global $hReBar, $hgui, $btnExit, $hToolbar, $hCombo, $hDTP, $hInput
    Global Const $WMSZ_LEFT = 1
    Global Const $WMSZ_RIGHT = 2

    [/autoit] [autoit][/autoit] [autoit]

    GUIRegisterMsg($WM_SIZE, "WM_SIZE")
    GUIRegisterMsg($WM_SIZING, "WM_SIZING")
    _main()
    Func _main()
    Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp
    $hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $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, $RBS_BANDBORDERS))
    ; 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)
    EndSwitch
    ; Add buttons
    _GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
    _GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
    _GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
    _GUICtrlToolbar_AddButtonSep($hToolbar)
    _GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)
    ; create a combobox to put in the rebar
    $hCombo = _GUICtrlComboBox_Create($hgui, "", 0, 0, 120)
    _GUICtrlComboBox_BeginUpdate($hCombo)
    _GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
    _GUICtrlComboBox_EndUpdate($hCombo)
    ; create a date time picker to put in the rebar
    $hDTP = _GUICtrlDTP_Create($hgui, 0, 0, 190)
    ; 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, 360, 100, 25)
    GUISetState(@SW_SHOW)
    While 1
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE, $btnExit
    Exit
    EndSwitch
    WEnd
    EndFunc ;==>_main

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_SIZE($hWnd)
    Local $wpos
    $wpos = WinGetPos($hWnd)
    ControlMove($hWnd, "", $hReBar, 0, 0, $wpos[2])
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_SIZE

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_SIZING($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam
    Switch $wParam ;drag side or corner
    Case $WMSZ_LEFT, $WMSZ_RIGHT
    _WinAPI_RedrawWindow($hgui, 0, 0, $RDW_UPDATENOW + $RDW_INVALIDATE + $RDW_ALLCHILDREN)
    Case Else
    _WinAPI_RedrawWindow($hgui, 0, 0, $RDW_UPDATENOW + $RDW_INVALIDATE + $RDW_ALLCHILDREN)
    EndSwitch
    Return "GUI_RUNDEFMSG"
    EndFunc ;==>WM_SIZING

    [/autoit] [autoit][/autoit] [autoit]

    Func _DebugPrint($s_text, $line = @ScriptLineNumber)
    ConsoleWrite( _
    "!===========================================================" & @LF & _
    "+======================================================" & @LF & _
    "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
    "+======================================================" & @LF)
    EndFunc ;==>_DebugPrint

    [/autoit]

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

    • Offizieller Beitrag

    Ich glaube die Rebar hat generell Probleme. Das Rebar Control scheint bei Win7 nicht richtig zu funktionieren, soweit ich aus Google schlau werde.
    Schau dir mal das Beispiel von _GUICtrlRebar_Create an. Verkleiner es mal und stelle es wieder her. ;)


    UEZ, dein Beispiel funzt :D