Sign in to follow this  
Followers 0
JackDinn

need help with a rebar and a toolbar

8 posts in this topic

#1 ·  Posted (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 :-

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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (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).

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

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  
Followers 0

  • Similar Content

    • Queener
      By Queener
      This is the info of the interface:
      Window
      Title:    Password Safe
      Class:    #32770
      Control
      Class:    ToolbarWindow32
      Instance:    2
      ClassnameNN:    ToolbarWindow322
      Name:    
      Advanced (Class):    [CLASS:ToolbarWindow32; INSTANCE:2]
       ToolsBar
      1:    32003    Make New Database
      2:    32002    Open Another Database
      3:    32004    Close Database
      4:    32005    Save Database
      5:    0    
      6:    32066    Copy Password to Clipboard
      7:    32068    Copy Username to Clipboard
      8:    32069    Copy Notes to Clipboard
      9:    32065    Clear the clipboard contents
      10:    0    
       
      I wanted to click on 1:    32003    Make New Database. But unfortunately, I'm unable to click on that. Any help is much appreciated. Below are the code I tried:

      $Title = "Password Safe" $Class = "[CLASS:ToolbarWindow32; INSTANCE:2]" WinWaitActive($Title) Sleep(500) Dim $hWnd = WinGetHandle($Title,"") Dim $hToolBar = ControlGetHandle($hWnd, '', $Class) ConsoleWrite($hWnd & @TAB & $hToolBar & @LF) _GUICtrlToolbar_ClickIndex($hToolBar, 32003)
    • OldGuyWalking
      By OldGuyWalking
      I want to click on a button that is inside a custom ToolBar on a nonAutoIT created form.  I've been using MouseClick but that fails if the toolbar is detached or if the form is resized.
      There is no ID associated with the toolbar but there is a handle.  I'm thinking that to get the handle I need a ControlID but that only gets me to the toolbar and I'd then need to have a way to identify the position of a button in order to click on it.  
      I'd found a discussion about identifying the position of a noname button by, I believe, it's Tip text back in December but I can't find it now.  Memory is a bit fuzzy on how I even got to the topic because at the time I was searching for something else.   I'll continue to search but if anyone has seen the topic, or knows of another solution could you please point me in that direction. 
      Thank you.
    • BlazerV60
      By BlazerV60
      Hello everyone!
      I'm working on a GUI that has 2 explorer windows embedded inside of it.
      Eventually I'm going to put 4 explorer windows inside of the GUI since it's convenient to have 1 program opened with 4 explorer windows embedded inside it, than having 4 seperate explorer windows opened.
      Anyway, I ran into some space problems. I'm trying to remove the icons/toolbar that appears on top of the explorer windows since they take up so much space. Here's a pic of what I mean:
       

      Here's my code:
      #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Constants.au3> Opt("WinTitleMatchMode", 4) Global $hMigration, $hExplHolder, $hExplorer, $hExplorer2, $sStartDir = "C:\" Global $iWidth = 800, $iHeight = 400 ;Create the Explorer GUI $hExplHolder = GUICreate("Explorer", $iWidth, $iHeight, Default, Default) Run('explorer.exe /n, "' & $sStartDir & '"') WinWait("[CLASS:CabinetWClass]") ;Wait until the window appears WinSetState("[CLASS:CabinetWClass]","",@SW_HIDE) WinMove($hExplorer, "", 0, 0, 400, 400) $hExplorer = WinGetHandle("[CLASS:CabinetWClass]") Run('explorer.exe /n, "' & $sStartDir & '"') WinWait("[CLASS:CabinetWClass]") ;Wait until the window appears WinSetState("[CLASS:CabinetWClass]","",@SW_HIDE) WinMove($hExplorer2, "", 400, 0, 400, 400) $hExplorer2 = WinGetHandle("[CLASS:CabinetWClass]") ;WinSetState($hExplorer, "", @SW_HIDE) ;WinMove($hExplorer, "", 0, 0, 400, 400) ;WinSetState($hExplorer2, "", @SW_HIDE) ;WinMove($hExplorer2, "", 400, 0, 400, 400) _WinAPI_SetParent($hExplorer, $hExplHolder) ;Puts the explorer window inside the GUI _WinAPI_SetWindowLong($hExplorer, $GWL_STYLE, -1064828928) ;Minuses the x button in the windows explorer (I think?) _WinAPI_SetParent($hExplorer2, $hExplHolder) ;Puts the explorer window inside the GUI _WinAPI_SetWindowLong($hExplorer2, $GWL_STYLE, -1064828928) ;Minuses the x button in the windows explorer (I think?) ControlListView($hExplorer, "", "[CLASS:SysListView32; INSTANCE:1]", "ViewChange", "list") ControlListView($hExplorer2, "", "[CLASS:SysListView32; INSTANCE:1]", "ViewChange", "list") $hList = GUICtrlCreateListView ("File", $iWidth + 4, 4, 292, 200, 0x0003 + 0x0008 + 0x0004) GUICtrlSetState (-1, 8) WinSetState($hExplorer, "", @SW_SHOW) WinSetState($hExplorer2, "", @SW_SHOW) GUISetState(@SW_SHOW, $hExplHolder) While 1 $msg = GUIGetMsg() Switch $msg Case -3 Exit Case -13 GUICtrlCreateListViewItem (@GUI_DRAGFILE, $hList) EndSwitch WEnd How can I remove those top icons/toolbar so that there's more room for the file listing?
      Edit: Extra props to whoever can make it so that the 2 explorer windows not do the brief flash before it disappears into the GUI.
      Thanks,
      Brian
    • Andreik
      By Andreik
      Why the text it's not vertically aligned in toolbar control?
      #include <GuiReBar.au3> #include <GuiToolbar.au3> #include <Constants.au3> Global Enum $Item1 = 1000, $Item2, $Item3 Local $hGUI = GUICreate('Example',450,300) Local $hRebar = _GUICtrlRebar_Create($hGUI, BitOR($RBS_FIXEDORDER,$CCS_NODIVIDER,$RBS_BANDBORDERS)) Local $hToolbar = _GUICtrlToolbar_Create($hGUI,$TBSTYLE_TRANSPARENT) _GUICtrlToolbar_AddString($hToolbar,'Item# 1') _GUICtrlToolbar_AddString($hToolbar,'Item# 2') _GUICtrlToolbar_AddString($hToolbar,'Item# 3') _GUICtrlToolbar_AddButton($hToolbar,$Item1,-2,0) _GUICtrlToolbar_AddButton($hToolbar,$Item1,-2,1) _GUICtrlToolbar_AddButton($hToolbar,$Item1,-2,2) _GUICtrlToolbar_SetButtonSize($hToolbar,32,150) _GUICtrlRebar_AddToolBarBand($hRebar,$hToolbar) GUISetState(@SW_SHOW,$hGUI) Do Sleep(10) Until GUIGetMsg() = -3 ; GUI_EVENT_CLOSE The code above will prodoce a window that will look like