Jump to content

toolbar in Rebar problem


JackDinn
 Share

Recommended Posts

hi,

I really dont know why i opted to use a rebar, i suppose it look good at the time but it been one headache after another. Iv managed to "fudge" my way through but iv noticed yet another problem with it.

Problem is that when i resize the GUI window the toolbar in the rebar disappears (as do other things but im only worried about the toolbar and its buttons).

Thing is that it works fine in XP but not win7 (iv not tested in Vista).

#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
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)
    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

tried _WinAPI_UpdateWindow ($hgui) after a resize but didn't work, what does work is minimizing & restore or going over the toolbar with the mouse (both no good in practice)

I did have this all working nicely until i tested on win7, then i had about 2 days work to "fudge" work-arounds to get it working in xp, Vista & win7 (hopefully) but i cant figure this one out.

so has anyone got a suggestion how i can refresh the toolbar after a resize in win7 & prob Vista ?

Cheers.

Edited by JackDinn

Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Link to comment
Share on other sites

  • Moderators

JackDinn,

Works fine for me on Vista HP x32 SP2. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

hmm, interesting ;)

I was using a VM but im sure it did the same on another comp when i tried it, o well i'll assume it does work for now then just hope i dont get to many users complaining.

Cheers Melba23

Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Link to comment
Share on other sites

  • 4 months later...

This one works for me on Win7 x64:

#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

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

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

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

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

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...