JackDinn Posted September 14, 2012 Share Posted September 14, 2012 (edited) Hi, I could really do with some help trying to sort out my GUI's main toolbar. i have been using it as it is for a long while now but now that im internationalizing the project i really need to have another look at the toolbar because in other languages some of the button labels are quite long in comparison to English and this is causing some problems. heres a demo of my toolbar as i have it atm :- expandcollapse popup#region ;**** Directives created by AutoIt3Wrapper_GUI **** #Tidy_Parameters=/rel #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <Constants.au3> #include <EditConstants.au3> #include <GuiButton.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <GuiImageList.au3> #include <GuiReBar.au3> #include <GuiToolbar.au3> #include <RebarConstants.au3> #include <ToolbarConstants.au3> #include <WindowsConstants.au3> Global $hgui Global $hReBar $Debug_RB = False _Main() Func _Main() Local $btnExit, $hToolbar, $hInput Global $hReBar, $aStrings[5] Global Enum $Hruntest = 1000, $Hconfig, $hDisplayCSV, $H_netmon, $H_graphdisplay $hgui = GUICreate("Rebar", 900, 396, 0, -1, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX)) GUIRegisterMsg($WM_SIZE, "WM_SIZE") $hReBar = _GUICtrlRebar_Create($hgui, $CCS_TOP + $RBS_FIXEDORDER + $RBS_BANDBORDERS) $hToolbar = _GUICtrlToolbar_Create($hgui, $CCS_NORESIZE + $TBSTYLE_FLAT + $TBSTYLE_LIST, $TBSTYLE_EX_DOUBLEBUFFER) $hImage = _GUIImageList_Create(18, 18, 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) _GUICtrlToolbar_SetImageList($hToolbar, $hImage) $aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, 'some long text') $aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, 'Config') $aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, 'CSV') $aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, 'Display') $aStrings[4] = _GUICtrlToolbar_AddString($hToolbar, "Netmon") ;group WITH autosize ############# ;~ _GUICtrlToolbar_AddButton($hToolbar, $Hruntest, 0, 0, $BTNS_AUTOSIZE) ;~ _GUICtrlToolbar_AddButton($hToolbar, $Hconfig, 1, 1, $BTNS_AUTOSIZE) ;~ _GUICtrlToolbar_AddButton($hToolbar, $hDisplayCSV, 2, 2, $BTNS_AUTOSIZE) ;~ _GUICtrlToolbar_AddButton($hToolbar, $H_graphdisplay, 3, 3, $BTNS_AUTOSIZE) ;~ _GUICtrlToolbar_AddButton($hToolbar, $H_netmon, 4, 4, $BTNS_AUTOSIZE) ;group WITHOUT autosize ############# _GUICtrlToolbar_AddButton($hToolbar, $Hruntest, 0, 0) _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) ;END ############# _GUICtrlRebar_AddToolBarBand($hReBar, $hToolbar, "", 0, $RBBS_NOGRIPPER) $Input1 = _GUICtrlEdit_Create($hgui, "60", 0, 0, 20, 20, $ES_LEFT) _GUICtrlRebar_AddBand($hReBar, $Input1, 50, 100, 'Cycle time (Minutes)' & " :", 1, $RBBS_NOGRIPPER) $traybut = _GUICtrlButton_Create($hgui, 'Tray', 0, 0, 90, 28, $BS_DEFPUSHBUTTON) _GUICtrlRebar_AddBand($hReBar, $traybut, 90, 90, "", 2, $RBBS_NOGRIPPER) $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, $iMsg, $iwParam, $ilParam) If $hWnd = $hgui Then $wPos = WinGetPos($hgui) ControlMove($hgui, "", $hReBar, 0, 0, $wPos[2]) EndIf EndFunc ;==>WM_SIZE When its first run iv set a long string on the first button which causes all the other buttons to be the same size and therefore elongate the toolbar. I found that i could use $BTNS_AUTOSIZE on the _GUICtrlToolbar_AddButton() (iv left the commented out lines to show this) and it looks much better but the toolbar itself is still the same lenth i.e. the right hand side button and input field will drop down to below the toolbar when the windows is resized smaller even when there is a lot of blank space left on the right hand side of the toolbar? Also while im on this subject iv always tried to remove the line that runs horizontally along the top of the toolbar. Can anyone help me get my toolbar & rebar in a better state Cheers, Edited September 14, 2012 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 More sharing options...
JackDinn Posted September 15, 2012 Author Share Posted September 15, 2012 Dam its spam, i thought id got some help for a minute 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 More sharing options...
LarsJ Posted September 16, 2012 Share Posted September 16, 2012 Hi JackDinn, If you use _GUICtrlRebar_AddBand($hReBar, $hToolbar, 350, 350, "", 0) to add the toolbar you can define the width of the band. The horizontal line along the top of the toolbar is an impact of the $CCS_NORESIZE flag. Remove this flag. Removing this flag unfortunately means that the text "Cycle time (Minutes) :" will not be displayed. I don't know why.To overcome this problem use a child window in the second band with a label and an edit control. (Using a child window in a band makes it possible to have several controls in a band (at least it looks like). Also a child window makes it easy to control the height of the ReBar. Just set the height of the window) tst01.au3 Lars Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
JackDinn Posted September 16, 2012 Author Share Posted September 16, 2012 (edited) ahh thx for the response , much better that someone trying to sell me (& everyone) watches LOL. really good advice about the _GUICtrlRebar_AddBand() instated of _GUICtrlRebar_AddToolBarBand() i just assumed that as its a toolbar i must use _GUICtrlRebar_AddToolBarBand() but tested and works great , thx . I dont understand what you mean by child window in this case ? do you mean create another toolbar or rebar and add that or are you talking about a normal window ? excellent stuff though , im so close now and in the grand scheme of things the line at the top is not the end of the world Edited September 16, 2012 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 More sharing options...
JackDinn Posted September 16, 2012 Author Share Posted September 16, 2012 hmm i tried with creating a "normal" GUI window and adding it with _GUICtrlRebar_AddBand($hReBar, $HGUI2, 50, 100,"", 1, $RBBS_NOGRIPPER) and thats give me some interesting stuff to tinker with , it put the whole GUI window into the rebar (cool ) so im just tinkering with removing the system bar from the GUI and see how we go. I now assume you did mean to use a "normal" GUI window now, good stuff thx. 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 More sharing options...
JackDinn Posted September 16, 2012 Author Share Posted September 16, 2012 (edited) hmm i can work with that for a bit (see what i can do with it) but what about the background colour of the child window ? i can set it to other colours but it wont match the rebar's skin colour and gradated affect (is a blue gradient on my win7). expandcollapse popup#region ;**** Directives created by AutoIt3Wrapper_GUI **** #Tidy_Parameters=/rel #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <Constants.au3> #include <EditConstants.au3> #include <GuiButton.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <GuiImageList.au3> #include <GuiReBar.au3> #include <GuiToolbar.au3> #include <RebarConstants.au3> #include <ToolbarConstants.au3> #include <WindowsConstants.au3> Global $hgui Global $hReBar $Debug_RB = False _Main() Func _Main() Local $btnExit, $hToolbar, $hInput Global $hReBar, $aStrings[5] Global Enum $Hruntest = 1000, $Hconfig, $hDisplayCSV, $H_netmon, $H_graphdisplay $hgui = GUICreate("Rebar", 900, 396, 0, -1, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX)) GUIRegisterMsg($WM_SIZE, "WM_SIZE") $hReBar = _GUICtrlRebar_Create($hgui, $CCS_TOP + $RBS_FIXEDORDER + $RBS_BANDBORDERS) $hToolbar = _GUICtrlToolbar_Create($hgui, $TBSTYLE_FLAT + $TBSTYLE_LIST, $TBSTYLE_EX_DOUBLEBUFFER) $hImage = _GUIImageList_Create(18, 18, 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) _GUICtrlToolbar_SetImageList($hToolbar, $hImage) $aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, 'some long text') $aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, 'Config') $aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, 'CSV') $aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, 'Display') $aStrings[4] = _GUICtrlToolbar_AddString($hToolbar, "Netmon") ;group WITH autosize ############# _GUICtrlToolbar_AddButton($hToolbar, $Hruntest, 0, 0, $BTNS_AUTOSIZE) _GUICtrlToolbar_AddButton($hToolbar, $Hconfig, 1, 1, $BTNS_AUTOSIZE) _GUICtrlToolbar_AddButton($hToolbar, $hDisplayCSV, 2, 2, $BTNS_AUTOSIZE) _GUICtrlToolbar_AddButton($hToolbar, $H_graphdisplay, 3, 3, $BTNS_AUTOSIZE) _GUICtrlToolbar_AddButton($hToolbar, $H_netmon, 4, 4, $BTNS_AUTOSIZE) ;~ _GUICtrlRebar_AddToolBarBand($hReBar, $hToolbar, "", 0, $RBBS_NOGRIPPER) _GUICtrlRebar_AddBand($hReBar, $hToolbar, 400, 650, "", 0) $HGUI2=GUICreate("www",300,20,0,0,$WS_POPUP,-1,$hReBar) GUICtrlCreateLabel("Cycle time (mins)",0,0,100) GUICtrlCreateInput("60",110,0) _GUICtrlRebar_AddBand($hReBar, $HGUI2, 350, 100,"", 1, $RBBS_NOGRIPPER) $traybut = _GUICtrlButton_Create($hgui, 'Tray', 0, 0, 90, 28, $BS_DEFPUSHBUTTON) _GUICtrlRebar_AddBand($hReBar, $traybut, 90, 90, "", 2, $RBBS_NOGRIPPER) $btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25) GUISetState(@SW_SHOW,$hgui) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $btnExit Exit EndSwitch WEnd EndFunc ;==>_Main Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam) If $hWnd = $hgui Then $wPos = WinGetPos($hgui) ControlMove($hgui, "", $hReBar, 0, 0, $wPos[2]) EndIf EndFunc ;==>WM_SIZE how am i going to get around this problem ? P.S. sorry i didnt see your demo code before all my posting above , :-/, sorry Edited September 16, 2012 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 More sharing options...
LarsJ Posted September 16, 2012 Share Posted September 16, 2012 Have you tried just to make the child window transparent ($WS_EX_TRANSPARENT).If you want no border at all at the top use$hReBar = _GUICtrlRebar_Create($hGui, $CCS_TOP + $CCS_NODIVIDER + $RBS_FIXEDORDER + $RBS_BANDBORDERS)Lars Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
JackDinn Posted September 16, 2012 Author Share Posted September 16, 2012 yea tried making the child window transparent and also tried making the controls background transparent , but unfortunately dont work, still a gray background Is no problem iv been using it with the line at the top for years now , i'll just continue to do so. My main problem is sorted though so many thx for that 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now