Function Reference


_GUICtrlStatusBar_SetParts

Sets the number of parts and the part edges

#include <GuiStatusBar.au3>
_GUICtrlStatusBar_SetParts ( $hWnd [, $vPartEdge = -1 [, $vPartWidth = 25]] )

Parameters

$hWnd Handle to the control
$vPartEdge [optional] Number of parts, can be an 0-based array of ints in the following format:
    $vPartEdge[0] - Right edge of part #1
    $vPartEdge[1] - Right edge of part #2
    $vPartEdge[n] - Right edge of part n
$vPartWidth [optional] Size of parts, can be an 0-based array of ints in the following format:
    $vPartWidth[0] - width part #1
    $vPartWidth[1] - width of part #2
    $vPartWidth[n] - width of part n

Return Value

Success: True.
Failure: False.

Remarks

If an element is -1, the right edge of the corresponding part extends to the border of the window.

$vPartWidth is ignored if $vPartEdge is an Array.
$vPartEdge and $vPartWidth being both an Array is an error.

Related

_GUICtrlStatusBar_GetParts

Example

Example 1

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

Global $g_idMemo

Example()

Func Example()
    Local $hGUI, $hStatus
    Local $aParts[3] = [75, 150, -1]

    ; Create GUI
    $hGUI = GUICreate("StatusBar Set Parts", 400, 300)
    $hStatus = _GUICtrlStatusBar_Create($hGUI)

    ; Create memo control
    $g_idMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
    GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
    GUISetState(@SW_SHOW)

    ; Set parts
    _GUICtrlStatusBar_SetParts($hStatus, $aParts)

    ;Set Text/ Get Width
    Local $iParts = _GUICtrlStatusBar_GetCount($hStatus)
    For $iI = 1 To $iParts
        _GUICtrlStatusBar_SetText($hStatus, "Text " & $iI, $iI - 1)
        MemoWrite("Part " & $iI & " width .: " & _GUICtrlStatusBar_GetWidth($hStatus, $iI - 1))
    Next

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

Exampe 2 With array of Widths

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

Global $g_idMemo

Example()

Func Example()
    Local $hGUI, $hStatus
    Local $aPartWidth[3] = [75, 75, -1]

    ; Create GUI
    $hGUI = GUICreate("StatusBar Set Parts", 400, 300)
    $hStatus = _GUICtrlStatusBar_Create($hGUI)

    ; Create memo control
    $g_idMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
    GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
    GUISetState(@SW_SHOW)

    ; Set parts
    _GUICtrlStatusBar_SetParts($hStatus, -1, $aPartWidth)

    ;Set Text/ Get Width
    Local $iParts = _GUICtrlStatusBar_GetCount($hStatus)
    For $iI = 1 To $iParts
        _GUICtrlStatusBar_SetText($hStatus, "Text " & $iI, $iI - 1)
        MemoWrite("Part " & $iI & " width .: " & _GUICtrlStatusBar_GetWidth($hStatus, $iI - 1))
    Next

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

Example 3 n Parts equal size

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

Global $g_idMemo

Example()

Func Example()
    Local $hGUI, $hStatus

    ; Create GUI
    $hGUI = GUICreate("StatusBar Set Parts", 400, 300)
    $hStatus = _GUICtrlStatusBar_Create($hGUI)

    ; Create memo control
    $g_idMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
    GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
    GUISetState(@SW_SHOW)

    ; Set parts
    _GUICtrlStatusBar_SetParts($hStatus, 3, 75)

    ;Set Text/ Get Width
    Local $iParts = _GUICtrlStatusBar_GetCount($hStatus)
    For $iI = 1 To $iParts
        _GUICtrlStatusBar_SetText($hStatus, "Text " & $iI, $iI - 1)
        MemoWrite("Part " & $iI & " width .: " & _GUICtrlStatusBar_GetWidth($hStatus, $iI - 1))
    Next

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

Example 4 only one Part

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

Global $g_idMemo

Example()

Func Example()
    Local $hGUI, $hStatus

    ; Create GUI
    $hGUI = GUICreate("StatusBar Set Parts", 400, 300)
    $hStatus = _GUICtrlStatusBar_Create($hGUI)

    ; Create memo control
    $g_idMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
    GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
    GUISetState(@SW_SHOW)

    ; Set 5 parts
    _GUICtrlStatusBar_SetParts($hStatus, 5)
    ; Reset to only one part
    _GUICtrlStatusBar_SetParts($hStatus)

    ;Set Text/ Get Width
    Local $iParts = _GUICtrlStatusBar_GetCount($hStatus)
    For $iI = 1 To $iParts
        _GUICtrlStatusBar_SetText($hStatus, "Text " & $iI, $iI - 1)
        MemoWrite("Part " & $iI & " width .: " & _GUICtrlStatusBar_GetWidth($hStatus, $iI - 1))
    Next

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite