Funktionreferenz


_GUICtrlStatusBar_SetParts

Beschreibung anzeigen in

Setzt die Anzahl von Abschnitten und Kanten der Abschnitte

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

Parameter

$hWnd Handle des Controls
$vPartEdge [optional] Anzahl von Abschnitten. Dies kann ein 0-basierendes Array mit Integern im folgenden Format sein:
    $vPartEdge[0] - Rechte Kante des Abschnitts #1
    $vPartEdge[1] - Rechte Kante des Abschnitts #2
    $vPartEdge[n] - Rechte Kante des Abschnitts n
$vPartWidth [optional] Breite der Abschnitte. Dies kann ein 0-basierendes Array mit Integern im folgenden Format sein:
    $vPartWidth[0] - Breite des Abschnitts #1
    $vPartWidth[1] - Breite des Abschnitts #2
    $vPartWidth[n] - Breite des Abschnitts n

Rückgabewert

Erfolg: True
Fehler: False

Bemerkungen

Falls ein Item -1 ist, entspricht die rechte Kante des entsprechenden Abschnittes dem Rand vom Fenster.

$vPartWidth wird ignoriert, falls $vPartEdge ein Array ist.
Sind $vPartEdge und $vPartWidth ein Array, so resultiert dies in einem Fehler.

- - - - - - - - Erklärung der Controls - - - - - - - -

Verwandte Funktionen

_GUICtrlStatusBar_GetParts

Beispiel

Example 1 : with default Widths

#include "Extras\HelpFileInternals.au3"

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

Example()

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

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

    ; Set/Get parts
    Local $aParts[3] = [75, 150, -1]
    _GUICtrlStatusBar_SetParts($hStatus, $aParts)

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

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

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

Beispiel 2 : mit Array der Breiten

#include "Extras\HelpFileInternals.au3"

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

Example()

Func Example()
    ; Erstellt eine GUI
    Local $hGUI = GUICreate("StatusBar: Setzt und ermittelt die Anzahl von Abschnitten (v" & @AutoItVersion & ")", 600, 320, 100, 100)
    Local $hStatus = _GUICtrlStatusBar_Create($hGUI)

    ; Erstellt ein Memo Control
    _MemoCreate(2, 8, 444, 259)
    GUISetState(@SW_SHOW)

    ; Setzt die Anzahl von Abschnitten
    Local $aPartWidth[3] = [75, 75, -1]
    _GUICtrlStatusBar_SetParts($hStatus, -1, $aPartWidth)

    ;Setzt Text und ermittelt die Breite
    Local $iParts = _GUICtrlStatusBar_GetCount($hStatus)
    For $iI = 0 To $iParts - 1
        _GUICtrlStatusBar_SetText($hStatus, "Text " & $iI, $iI)
        _MemoWrite("Abschnitt " & $iI & " Breite .: " & _GUICtrlStatusBar_GetWidth($hStatus, $iI))
    Next

    _MemoMsgBoxStatus("", -1, $hGUI) ; Keine weiteren Aktionen, es wird gewartet bis die GUI geschlossen wird.

    ; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

Beispiel 3: n Abschnitte gleiche Größe

#include "Extras\HelpFileInternals.au3"

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

Example()

Func Example()
    ; Erstellt eine GUI
    Local $hGUI = GUICreate("StatusBar setzt Abschnitte (v" & @AutoItVersion & ")", 450, 320, 100, 100)
    Local $hStatus = _GUICtrlStatusBar_Create($hGUI)

    ; Erstellt ein Memo Control
    _MemoCreate(2, 8, 444, 259)
    GUISetState(@SW_SHOW)

    ; Setzt Abschnitte
    _GUICtrlStatusBar_SetParts($hStatus, 3, 75)

    ;Setzt Text und ermittelt die Breite
    Local $iParts = _GUICtrlStatusBar_GetCount($hStatus)
    For $iI = 0 To $iParts - 1
        _GUICtrlStatusBar_SetText($hStatus, "Text " & $iI, $iI)
        _MemoWrite("Abschnitt " & $iI & " Breite .: " & _GUICtrlStatusBar_GetWidth($hStatus, $iI))
    Next

    _MemoMsgBoxStatus("", -1, $hGUI) ; Keine weiteren Aktionen, es wird gewartet bis die GUI geschlossen wird.

    ; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

Beispiel 4: nur ein Abschnitt

#include "Extras\HelpFileInternals.au3"

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

Example()

Func Example()
    ; Erstellt eine GUI
    Local $hGUI = GUICreate("StatusBar setzt Abschnitte (v" & @AutoItVersion & ")", 450, 320, 100, 100)
    Local $hStatus = _GUICtrlStatusBar_Create($hGUI)

    ; Erstellt ein Memo Control
    _MemoCreate(2, 8, 444, 259)
    GUISetState(@SW_SHOW)

    ; Setzt 5 Abschnitte
    _GUICtrlStatusBar_SetParts($hStatus, 5)
    ; Rücksetzung auf nur einen Teil
    _GUICtrlStatusBar_SetParts($hStatus)

    ;Setzt Text und ermittelt die Breite
    Local $iParts = _GUICtrlStatusBar_GetCount($hStatus)
    For $iI = 0 To $iParts - 1
        _GUICtrlStatusBar_SetText($hStatus, "Text " & $iI, $iI)
        _MemoWrite("Abschnitt " & $iI & " Breite .: " & _GUICtrlStatusBar_GetWidth($hStatus, $iI))
    Next

    _MemoMsgBoxStatus("", -1, $hGUI) ; Keine weiteren Aktionen, es wird gewartet bis die GUI geschlossen wird.

    ; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example