Function Reference


_GUICtrlStatusBar_SetText

Sets the text in the specified part of a status window

#include <GuiStatusBar.au3>
_GUICtrlStatusBar_SetText ( $hWnd [, $sText = "" [, $iPart = 0 [, $iUFlag = 0]]] )

Parameters

$hWnd Handle to the control
$sText [optional] The text to display in the part
$iPart [optional] The part to hold the text
$iUFlag [optional] Type of drawing operation. The type can be one of the following values:
    0 - The text is drawn with a border to appear lower than the plane of the window
    $SBT_NOBORDERS - The text is drawn without borders
    $SBT_OWNERDRAW - The text is drawn by the parent window
    $SBT_POPOUT - The text is drawn with a border to appear higher than the plane of the window
    $SBT_RTLREADING - The text will be displayed in the opposite direction to the text in the parent window

Return Value

Success: True.
Failure: False.

Remarks

Set $iPart to $SB_SIMPLEID for simple statusbar.

Related

_GUICtrlStatusBar_GetText

Example

Example 1 use with icon handle

#include "Extras\HelpFileInternals.au3"

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

Example()

Func Example()
    ; Create GUI
    Local $hGUI = GUICreate("StatusBar Get/Set Text (v" & @AutoItVersion & ")", 450, 320, 100, 100)
    Local $hStatus = _GUICtrlStatusBar_Create($hGUI)

    ; Create memo control
    _MemoCreate(2, 8, 444, 259)

    GUISetState(@SW_SHOW)

    ; Set parts
    Local $aParts[4] = [75, 150, 300, 400]
    _GUICtrlStatusBar_SetParts($hStatus, $aParts)
    _GUICtrlStatusBar_SetText($hStatus, "Part 0")
    _GUICtrlStatusBar_SetText($hStatus, "Part 1", 1)
    _GUICtrlStatusBar_SetText($hStatus, "Part 2", 2)
    _GUICtrlStatusBar_SetText($hStatus, "Part 3", 3)
    Local $iWrongSetText = _GUICtrlStatusBar_SetText($hStatus, "Wrong Part", 4)

    ; Set icons
    Local $ahIcons[2]
    $ahIcons[0] = _WinAPI_LoadShell32Icon(23)
    $ahIcons[1] = _WinAPI_LoadShell32Icon(40)
    _GUICtrlStatusBar_SetIcon($hStatus, 0, $ahIcons[0])
    _GUICtrlStatusBar_SetIcon($hStatus, 1, $ahIcons[1])

    ; Show part text
    _MemoWrite("Part 0 text ........: " & _GUICtrlStatusBar_GetText($hStatus, 0))
    _MemoWrite("Part 1 text ........: " & _GUICtrlStatusBar_GetText($hStatus, 1))

    ; Show icon handles
    _MemoWrite("Part 0 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon($hStatus, 0)))
    _MemoWrite("Part 1 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon($hStatus, 1)))

    _MemoWrite("Wrong Part SetText .: " & $iWrongSetText)

    _MemoMsgBoxStatus("", -1, $hGUI) ; no more action, wait GUI for closing

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    ; Free icons
    _WinAPI_DestroyIcon($ahIcons[0])
    _WinAPI_DestroyIcon($ahIcons[1])
    GUIDelete()
EndFunc   ;==>Example

Example 2 : direct use with icon file

#include "Extras\HelpFileInternals.au3"

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

Example()

Func Example()
    ; Create GUI
    Local $hGUI = GUICreate("StatusBar Get/Set Text (v" & @AutoItVersion & ")", 450, 320, 100, 100)
    Local $hStatus = _GUICtrlStatusBar_Create($hGUI)

    ; Create memo control
    _MemoCreate(2, 8, 444, 259)
    GUISetState(@SW_SHOW)

    ; Set parts
    Local $aParts[4] = [75, 150, 300, 400]
    _GUICtrlStatusBar_SetParts($hStatus, $aParts)
    _GUICtrlStatusBar_SetText($hStatus, "Part 0")
    _GUICtrlStatusBar_SetText($hStatus, "Part 1", 1)
    _GUICtrlStatusBar_SetText($hStatus, "Part 2", 2)
    _GUICtrlStatusBar_SetText($hStatus, "Part 3", 3)

    ; Set icons
    _GUICtrlStatusBar_SetIcon($hStatus, 0, 23, "shell32.dll")
    _GUICtrlStatusBar_SetIcon($hStatus, 1, 40, "shell32.dll")

    ; Show part text
    _MemoWrite("Part 0 text ........: " & _GUICtrlStatusBar_GetText($hStatus, 0))
    _MemoWrite("Part 1 text ........: " & _GUICtrlStatusBar_GetText($hStatus, 1))

    ; Show icon handles
    _MemoWrite("Part 0 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon($hStatus, 0)))
    _MemoWrite("Part 1 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon($hStatus, 1)))

    _MemoMsgBoxStatus("", -1, $hGUI) ; no more action, wait GUI for closing

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

Example 3 : StatusBar Get/Set Text to an External process

#include "Extras\HelpFileInternals.au3"

#include <GuiStatusBar.au3>

Example()

Func Example()
    Local $sFromTo
    Local $hWin = _MemoRunAU3OutProcess($sFromTo)

    Local $hStatus = _MemoCreateOutProcess($hWin, "msctls_statusbar32", 0, $sFromTo)

    Local $iPart = 0
    _GUICtrlStatusBar_SetText($hStatus, "UPD 0", $iPart) ; update the external Process StatusBar part 0

    _MemoWrite(@CRLF & "=====================" & @CRLF & "StatusBar info displayed" & $sFromTo & " External process" & @CRLF & "=====================")
    ; Show part text
    _MemoWrite("Part " & $iPart & " text ........: " & _GUICtrlStatusBar_GetText($hStatus, $iPart))
    _MemoWrite("Parts count ........: " & _GUICtrlStatusBar_GetCount($hStatus))
    Local $aParts = _GUICtrlStatusBar_GetParts($hStatus)
    For $iI = 0 To $aParts[0] - 1
        _MemoWrite("Part " & $iI & " width .: " & _GUICtrlStatusBar_GetWidth($hStatus, $iI) & " (" & $aParts[$iI + 1] & ")")
    Next

    _MemoWrite(@CRLF & "=====================")

    _MemoMsgBoxStatus("", Default, $hWin) ; no more action, wait GUI for closing, close also OutProcess GUI

EndFunc   ;==>Example