Sign in to follow this  
Followers 0
BlackHoleSun

Make the status bar stay at 100% width on resize

5 posts in this topic

How do you make the status bar stay on the bottom and 100% width when you resize your window? Also, I have the resize option in the bottom right of just the status bar, but the option isn't set, and it's cutting off the end of my copyright text. If I enter spaces it's fine. So how do I fix that? My code is below:

Local $statusTxt[2] = ["Status", @TAB & @TAB & "© First Name Last Name"]
$guiStatusBar = _GUICtrlStatusBar_Create($gui, 100, $statusTxt)

Share this post


Link to post
Share on other sites



Share this post


Link to post
Share on other sites

Two lines are not enough :graduated:... make an executable example and the chances for an useful answer will rise dramatically :( ...

$version = 0.1

Global $gui

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <TreeViewConstants.au3>
#include <GuiStatusBar.au3>
#include <AD.au3>

Opt('MustDeclareVars', 1)

;_AD_Open()

_Main()

Func _Main()
   
    ;GUI
    $gui = GUICreate("Query v" & $version, 700, 370, (@DesktopWidth - 700) / 2, (@DesktopHeight - 370) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
   
    ;File Menu
    Local $menuFile, $menuItemExit
    $menuFile = GUICtrlCreateMenu("&File")
    $menuItemExit = GUICtrlCreateMenuItem("E&xit", $menuFile)
   
    ;Query Input
    Local $queryLbl, $queryIn, $querySub
    $queryLbl = GUICtrlCreateLabel("Query:", 5, 5)
    $queryIn = GUICtrlCreateInput("", 40, 2, 150, 20)
    $querySub = GUICtrlCreateButton("Su&bmit", 191, 1, 50, 22)
   
    ;Status Bar
    Local $guiStatusBar
    Local $statusTxt[2] = ["Status", @TAB & @TAB & "© Me 2010      "]
    $guiStatusBar = _GUICtrlStatusBar_Create($gui, 100, $statusTxt)
   
    GUISetState()
   
    While 1
        Local $msg
        $msg = GUIGetMsg()

        Select
            Case $msg = $GUI_EVENT_CLOSE Or $msg = $menuItemExit
                _Exit()

            Case $msg = $querySub
                _Query(GUICtrlRead($queryIn))
               
        EndSelect
    WEnd
    GUIDelete()

    _Exit()
EndFunc   ;==>_Main

Func _Query($query)
    
EndFunc   ;==>_Query

Func _Exit()
    ;_AD_Close()
    Exit
EndFunc   ;==> _Exit

Share this post


Link to post
Share on other sites

This fixes the resizing... about the text being cut, it's just the length of the string (two tabs). A solution might be to have the right path right oriented, but I don't know if that is possible :graduated:...

$version = 0.1

Global $gui, $guiStatusBar

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <TreeViewConstants.au3>
#include <GuiStatusBar.au3>

Opt('MustDeclareVars', 1)

;_AD_Open()

_Main()

Func _Main()

    ;GUI
    $gui = GUICreate("Query v" & $version, 700, 370, (@DesktopWidth - 700) / 2, (@DesktopHeight - 370) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

    ;File Menu
    Local $menuFile, $menuItemExit
    $menuFile = GUICtrlCreateMenu("&File")
    $menuItemExit = GUICtrlCreateMenuItem("E&xit", $menuFile)

    ;Query Input
    Local $queryLbl, $queryIn, $querySub
    $queryLbl = GUICtrlCreateLabel("Query:", 5, 5)
    $queryIn = GUICtrlCreateInput("", 40, 2, 150, 20)
    $querySub = GUICtrlCreateButton("Su&bmit", 191, 1, 50, 22)

    ;Status Bar
    Local $statusTxt[2] = ["Status", @TAB & "© Me 2010      "]
    $guiStatusBar = _GUICtrlStatusBar_Create($gui, 100, $statusTxt,$SBARS_SIZEGRIP)

    GUIRegisterMsg($WM_SIZE, "MY_WM_SIZE")

    GUISetState()

    While 1
        Local $msg
        $msg = GUIGetMsg()

        Select
            Case $msg = $GUI_EVENT_CLOSE Or $msg = $menuItemExit
                _Exit()

            Case $msg = $querySub
                _Query(GUICtrlRead($queryIn))

        EndSelect
    WEnd
    GUIDelete()

    _Exit()
EndFunc   ;==>_Main

Func _Query($query)

EndFunc   ;==>_Query

Func _Exit()
    ;_AD_Close()
    Exit
EndFunc   ;==>_Exit

Func MY_WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    _GUICtrlStatusBar_Resize($guiStatusBar)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>MY_WM_SIZE

Share this post


Link to post
Share on other sites

Thanks KaFu! It works like a charm now. I did notice I can resize the window with either the status bar or the window border itself. I guess I'll have to look into resizing the gui some more. Thanks again!

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