Statusbar wird nichz richtig angezeigt

  • Guten Abend!

    Kann mir jemand sagen wieso bei meinem Programm die Statusbar nicht richtig angezeigt wird? Bei einem Beispiel das ich ausprobiert habe funktioniert das problemlos.

    Mein Programm:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <string.au3>
    #include <array.au3>
    #Include <GuiStatusBar.au3>
    #include <GUIConstants.au3>
    #Include <GuiListView.au3>
    #include <Constants.au3>
    #include <ProgressConstants.au3>
    #include <GuiListView.au3>
    #include <StaticConstants.au3>
    #include <SliderConstants.au3>
    #include <EditConstants.au3>
    #include <Sound.au3>
    #include <File.au3>
    #include <GuiComboBox.au3>
    #include <GuiStatusBar.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Misc.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _Main()

    [/autoit] [autoit][/autoit] [autoit]

    Func _Main()

    [/autoit] [autoit][/autoit] [autoit]

    $oWMP = ObjCreate ( "WMPLayer.ocx" )

    [/autoit] [autoit][/autoit] [autoit]

    Local $Label_1, $Combo_2, $button1, $msg, $data, $Form1,$Form2, $Play, $Stop, $Homepage, $Label2, $Checkbox1, $Group1, $Sender, $Label1, $masta, $oIE, $masta2, $lauter, $leiser, $Group2, $filemenu, $fileitem, $fileitem2
    Local $Form1, $hStatus
    Local $aParts[3] = [75, 150, -1]

    [/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("Grillbier-Radio", 424, 270)
    $hStatus = _GUICtrlStatusBar_Create ($Form1)
    _GUICtrlStatusBar_SetParts ($hStatus, $aParts)
    $aParts = _GUICtrlStatusBar_GetParts ($hStatus)
    $filemenu = GUICtrlCreateMenu("Datei")
    $fileitem = GUICtrlCreateMenuItem("About", $filemenu)
    $fileitem2 = GUICtrlCreateMenuItem("Beenden", $filemenu)
    $Play = GUICtrlCreateButton("Play", 40, 112, 97, 41, 0)
    GUICtrlSetFont(-1, 10, 400, 2, "Century Gothic")
    $Stop = GUICtrlCreateButton("Stop", 152, 112, 97, 41, 0)
    GUICtrlSetFont(-1, 10, 400, 2, "Century Gothic")
    $Homepage = GUICtrlCreateButton("Homepage", 264, 112, 105, 41, 0)
    GUICtrlSetFont(-1, 10, 400, 2, "Century Gothic")
    $Group1 = GUICtrlCreateGroup("Sender", 24, 16, 378, 89)
    GUICtrlSetFont(-1, 10, 400, 2, "Century Gothic")
    $Sender = GUICtrlCreateCombo("", 40, 72, 345, 25,BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL, $CBS_SORT))
    _GUICtrlComboBox_SetMinVisible($Sender, 8);Es sind in der Combobox $Sender immer mindestens 8 Items sichtbar
    GUICtrlSetData($Sender, "TranceBase.fm|TechnoBase.fm|Hardbase.fm|HouseTime.fm|ReggaeTrade.fm|HardeR - Rautemusik|eXTreMe - Rautemusik|DRS 3|DRS 2|DRS 1|Radio Grischa|Black Beats - HipHop|BigCityBeats - Rautemusik|Main - Rautemusik|Club - Rautemusik|JaM - Rautemusik|FunkY - Rautemusik")
    $Label1 = GUICtrlCreateLabel("Bitte einen Radiosender auswählen!", 40, 40, 346, 17,$SS_CENTER)
    GUICtrlSetFont(-1, 10, 400, 2, "Century Gothic")
    GUISetState(@SW_SHOW)
    $Volume = GUICtrlCreateSlider(27, 195, 180, 175, BitOR($TBS_AUTOTICKS, $TBS_Left))
    GUICtrlSetData(-1, 50)
    $goupvolume = GUICtrlCreatelabel("Volume:",40,180,185,20)
    GUICtrlSetFont(-1, 10, 400, 2, "Century Gothic")
    $Labelvolume = GUICtrlCreateLabel(GUICtrlRead($volume)&"%",95,180,50,20,$SS_CENTER)
    GUICtrlSetFont(-1, 10, 400, 2, "Century Gothic")
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $Play
    $data = GUICtrlRead($Sender)
    GUICtrlSetData($Label1,"Sie hören: " & $data)
    If $data = "Technobase.fm" Then
    $oWMP.URL = "http://DSL.TechnoBase.eu/listen-dsl.asx"
    elseif $data = "HardBase.fm" Then
    $oWMP.URL = "http://mp3.hardbase.fm/listen.asx"
    elseif $data = "TranceBase.fm" Then
    $oWMP.URL = "http://mp3.TranceBase.fm/listen.asx"
    elseif $data = "Housetime.fm" Then
    $oWMP.URL = "http://high.HouseTime.FM/listen.asx"
    elseif $data = "eXTreMe - Rautemusik" Then
    $oWMP.URL = "http://extreme-high.rautemusik.fm/listen.asx"
    elseif $data = "HardeR - Rautemusik" Then
    $oWMP.URL = "http://harder-high.rautemusik.fm/listen.asx"
    elseif $data = "ReggaeTrade.fm" Then
    $oWMP.URL = "http://www.1.fm/wm/energyreggae128k.asx"
    elseif $data = "DRS 1" Then
    $oWMP.URL = "http://asx.skypro.ch/radio/internet-64/drs1.asx"
    elseif $data = "DRS 2" Then
    $oWMP.URL = "http://asx.skypro.ch/radio/internet-64/drs2.asx"
    elseif $data = "DRS 3" Then
    $oWMP.URL = "http://asx.skypro.ch/radio/internet-64/drs3.asx"
    elseif $data = "Radio Grischa" Then
    $oWMP.URL = "http://asx.skypro.ch/radio/internet-128/grischa.asx"
    elseif $data = "Black Beats - HipHop" Then
    $oWMP.URL = "http://www.blackbeats.fm/listen.asx"
    elseif $data = "BigCityBeats - Rautemusik" Then
    $oWMP.URL = "http://bcb-high.rautemusik.fm/listen.asx"
    elseif $data = "Main - Rautemusik" Then
    $oWMP.URL = "http://main-high.rautemusik.fm/listen.asx"
    elseif $data = "Club - Rautemusik" Then
    $oWMP.URL = "http://club-high.rautemusik.fm/listen.asx"
    elseif $data = "JaM - Rautemusik" Then
    $oWMP.URL = "http://jam-high.rautemusik.fm/listen.asx"
    elseif $data = "FunkY - Rautemusik" Then
    $oWMP.URL = "http://funky-high.rautemusik.fm/listen.asx"
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $Stop
    $oWMP.controls.stop()

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $Homepage
    $masta = GUICtrlRead($Sender)
    If $masta = "TechnoBase.fm" Then
    GUICtrlSetData($Label1,"www." & $masta)
    ShellExecute("http://www.TechnoBase.fm")
    ElseIf $masta = "HardBase.fm" Then
    GUICtrlSetData($Label1,"www." & $masta)
    ShellExecute("http://www.HardBase.fm")
    ElseIf $masta = "Black Beats - HipHop" Then
    GUICtrlSetData($Label1,"www." & $masta)
    ShellExecute("http://www.Blackbeats.fm")
    ElseIf $masta = "TranceBase.fm" Then
    GUICtrlSetData($Label1,"www." & $masta)
    ShellExecute("http://www.TranceBase.fm")
    ElseIf $masta = "HouseTime.fm" Then
    GUICtrlSetData($Label1,"www." & $masta)
    ShellExecute("http://www.HouseTime.fm")
    ElseIf $masta = "eXTreMe - Rautemusik" Then
    GUICtrlSetData($Label1,"www.Rautemusik.fm")
    ShellExecute("http://www.rautemusik.fm/news.php?section=extreme")
    ElseIf $masta = "ReggaeTrade.fm" Then
    GUICtrlSetData($Label1,"www." & $masta)
    ShellExecute("http://www.radioreggaetrade.com/")
    ElseIf $masta = "HardeR - Rautemusik" Then
    GUICtrlSetData($Label1,"www.Rautemusik.fm")
    ShellExecute("http://www.rautemusik.fm/news.php?section=harder")
    ElseIf $masta = "DRS 1" Then
    GUICtrlSetData($Label1,"www.DRS1.ch")
    ShellExecute("http://www.DRS1.ch")
    ElseIf $masta = "DRS 2" Then
    GUICtrlSetData($Label1,"www.DRS2.ch")
    ShellExecute("http://www.DRS2.ch")
    ElseIf $masta = "DRS 3" Then
    GUICtrlSetData($Label1,"www.DRS3.ch")
    ShellExecute("http://www.DRS3.ch")
    ElseIf $masta = "Radio Grischa" Then
    GUICtrlSetData($Label1,"www.RadioGrischa.ch")
    ShellExecute("http://www.RadioGrischa.ch")
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $fileitem2
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $fileitem
    _About()

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $Volume
    SoundSetWaveVolume(GUICtrlRead($Volume))
    GUICtrlSetData($Labelvolume,GUICtrlRead($volume) & "%")

    [/autoit] [autoit][/autoit] [autoit]

    EndSelect
    WEnd
    exit
    EndFunc ; --> _Main

    [/autoit] [autoit][/autoit] [autoit]

    Func _About()
    Local $Form2, $GroupBox1, $Image1, $Label1, $Label2, $Label3

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("About", 200, 174, 400, 235)
    $Label1 = GUICtrlCreateLabel("InternetRadio", 25, 32, 104, 22, $WS_GROUP)
    GUICtrlSetFont(-1, 11, 400, 2, "Century Gothic")
    $Label2 = GUICtrlCreateLabel("Version 1.2", 24, 64, 83, 22, $WS_GROUP)
    GUICtrlSetFont(-1, 11, 400, 2, "Century Gothic")
    $Label3 = GUICtrlCreateLabel("by Troin", 24, 96, 104, 22)
    GUICtrlSetFont(-1, 11, 400, 2, "Century Gothic")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    local $msg
    $msg = GUIGetMsg()
    Select
    case $msg = $GUI_EVENT_CLOSE
    GUIDelete("About")
    ExitLoop
    EndSelect
    wend
    EndFunc

    [/autoit]

    Das Beispielprogramm:

    Spoiler anzeigen
    [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

    Opt('MustDeclareVars', 1)
    Global $iMemo

    [/autoit] [autoit][/autoit] [autoit]

    _Main()

    [/autoit] [autoit][/autoit] [autoit]

    Func _Main()

    [/autoit] [autoit][/autoit] [autoit]

    Local $hGUI, $hStatus
    Local $aParts[3] = [75, 150, -1]

    [/autoit] [autoit][/autoit] [autoit]

    ; Create GUI
    $hGUI = GUICreate("StatusBar Set Parts", 400, 300)
    GUISetState(@SW_SHOW)
    $hStatus = _GUICtrlStatusBar_Create ($hGUI)
    ; Set/Get parts
    _GUICtrlStatusBar_SetParts ($hStatus, $aParts)
    $aParts = _GUICtrlStatusBar_GetParts ($hStatus)
    Sleep(5000)
    EndFunc ;==>_Main

    [/autoit]

    mfg Troin

    Einmal editiert, zuletzt von Troin (21. Juni 2009 um 22:18)

    • Offizieller Beitrag

    So funktioniert es:

    Spoiler anzeigen
    [autoit]

    #include <ComboConstants.au3>
    #include <GUIConstants.au3>
    #include <string.au3>
    #include <array.au3>
    #Include <GuiStatusBar.au3>
    #include <GUIConstants.au3>
    #Include <GuiListView.au3>
    #include <Constants.au3>
    #include <ProgressConstants.au3>
    #include <GuiListView.au3>
    #include <StaticConstants.au3>
    #include <SliderConstants.au3>
    #include <EditConstants.au3>
    #include <Sound.au3>
    #include <File.au3>
    #include <GuiComboBox.au3>
    #include <GuiStatusBar.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Misc.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _Main()

    [/autoit] [autoit][/autoit] [autoit]

    Func _Main()

    [/autoit] [autoit][/autoit] [autoit]

    $oWMP = ObjCreate ( "WMPLayer.ocx" )

    [/autoit] [autoit][/autoit] [autoit]

    Local $Label_1, $Combo_2, $button1, $msg, $data, $Form1,$Form2, $Play, $Stop, $Homepage, $Label2, $Checkbox1, $Group1, $Sender, $Label1, $masta, $oIE, $masta2, $lauter, $leiser, $Group2, $filemenu, $fileitem, $fileitem2
    Local $Form1, $hStatus
    Local $aParts[3] = [75, 150, 100]

    [/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("Grillbier-Radio", 424, 330)
    $filemenu = GUICtrlCreateMenu("Datei")
    $fileitem = GUICtrlCreateMenuItem("About", $filemenu)
    $fileitem2 = GUICtrlCreateMenuItem("Beenden", $filemenu)
    $Play = GUICtrlCreateButton("Play", 40, 112, 97, 41, 0)
    GUICtrlSetFont(-1, 10, 400, 2, "Century Gothic")
    $Stop = GUICtrlCreateButton("Stop", 152, 112, 97, 41, 0)
    GUICtrlSetFont(-1, 10, 400, 2, "Century Gothic")
    $Homepage = GUICtrlCreateButton("Homepage", 264, 112, 105, 41, 0)
    GUICtrlSetFont(-1, 10, 400, 2, "Century Gothic")
    $Group1 = GUICtrlCreateGroup("Sender", 24, 16, 378, 89)
    GUICtrlSetFont(-1, 10, 400, 2, "Century Gothic")
    $Sender = GUICtrlCreateCombo("", 40, 72, 345, 25,BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL, $CBS_SORT))
    _GUICtrlComboBox_SetMinVisible($Sender, 8);Es sind in der Combobox $Sender immer mindestens 8 Items sichtbar
    GUICtrlSetData($Sender, "TranceBase.fm|TechnoBase.fm|Hardbase.fm|HouseTime.fm|ReggaeTrade.fm|HardeR - Rautemusik|eXTreMe - Rautemusik|DRS 3|DRS 2|DRS 1|Radio Grischa|Black Beats - HipHop|BigCityBeats - Rautemusik|Main - Rautemusik|Club - Rautemusik|JaM - Rautemusik|FunkY - Rautemusik")
    $Label1 = GUICtrlCreateLabel("Bitte einen Radiosender auswählen!", 40, 40, 346, 17,$SS_CENTER)
    GUICtrlSetFont(-1, 10, 400, 2, "Century Gothic")
    GUISetState(@SW_SHOW)
    $Volume = GUICtrlCreateSlider(27, 195, 180, 175, BitOR($TBS_AUTOTICKS, $TBS_Left))
    GUICtrlSetData(-1, 50)
    $goupvolume = GUICtrlCreatelabel("Volume:",40,180,185,20)
    GUICtrlSetFont(-1, 10, 400, 2, "Century Gothic")
    $Labelvolume = GUICtrlCreateLabel(GUICtrlRead($volume)&"%",95,180,50,20,$SS_CENTER)
    GUICtrlSetFont(-1, 10, 400, 2, "Century Gothic")
    $hStatus = _GUICtrlStatusBar_Create ($Form1)
    _GUICtrlStatusBar_SetParts ($hStatus, $aParts)
    $aParts = _GUICtrlStatusBar_GetParts ($hStatus)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $Play
    $data = GUICtrlRead($Sender)
    GUICtrlSetData($Label1,"Sie hören: " & $data)
    If $data = "Technobase.fm" Then
    $oWMP.URL = "http://DSL.TechnoBase.eu/listen-dsl.asx"
    elseif $data = "HardBase.fm" Then
    $oWMP.URL = "http://mp3.hardbase.fm/listen.asx"
    elseif $data = "TranceBase.fm" Then
    $oWMP.URL = "http://mp3.TranceBase.fm/listen.asx"
    elseif $data = "Housetime.fm" Then
    $oWMP.URL = "http://high.HouseTime.FM/listen.asx"
    elseif $data = "eXTreMe - Rautemusik" Then
    $oWMP.URL = "http://extreme-high.rautemusik.fm/listen.asx"
    elseif $data = "HardeR - Rautemusik" Then
    $oWMP.URL = "http://harder-high.rautemusik.fm/listen.asx"
    elseif $data = "ReggaeTrade.fm" Then
    $oWMP.URL = "http://www.1.fm/wm/energyreggae128k.asx"
    elseif $data = "DRS 1" Then
    $oWMP.URL = "http://asx.skypro.ch/radio/internet-64/drs1.asx"
    elseif $data = "DRS 2" Then
    $oWMP.URL = "http://asx.skypro.ch/radio/internet-64/drs2.asx"
    elseif $data = "DRS 3" Then
    $oWMP.URL = "http://asx.skypro.ch/radio/internet-64/drs3.asx"
    elseif $data = "Radio Grischa" Then
    $oWMP.URL = "http://asx.skypro.ch/radio/internet-128/grischa.asx"
    elseif $data = "Black Beats - HipHop" Then
    $oWMP.URL = "http://www.blackbeats.fm/listen.asx"
    elseif $data = "BigCityBeats - Rautemusik" Then
    $oWMP.URL = "http://bcb-high.rautemusik.fm/listen.asx"
    elseif $data = "Main - Rautemusik" Then
    $oWMP.URL = "http://main-high.rautemusik.fm/listen.asx"
    elseif $data = "Club - Rautemusik" Then
    $oWMP.URL = "http://club-high.rautemusik.fm/listen.asx"
    elseif $data = "JaM - Rautemusik" Then
    $oWMP.URL = "http://jam-high.rautemusik.fm/listen.asx"
    elseif $data = "FunkY - Rautemusik" Then
    $oWMP.URL = "http://funky-high.rautemusik.fm/listen.asx"
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $Stop
    $oWMP.controls.stop()

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $Homepage
    $masta = GUICtrlRead($Sender)
    If $masta = "TechnoBase.fm" Then
    GUICtrlSetData($Label1,"www." & $masta)
    ShellExecute("http://www.TechnoBase.fm")
    ElseIf $masta = "HardBase.fm" Then
    GUICtrlSetData($Label1,"www." & $masta)
    ShellExecute("http://www.HardBase.fm")
    ElseIf $masta = "Black Beats - HipHop" Then
    GUICtrlSetData($Label1,"www." & $masta)
    ShellExecute("http://www.Blackbeats.fm")
    ElseIf $masta = "TranceBase.fm" Then
    GUICtrlSetData($Label1,"www." & $masta)
    ShellExecute("http://www.TranceBase.fm")
    ElseIf $masta = "HouseTime.fm" Then
    GUICtrlSetData($Label1,"www." & $masta)
    ShellExecute("http://www.HouseTime.fm")
    ElseIf $masta = "eXTreMe - Rautemusik" Then
    GUICtrlSetData($Label1,"www.Rautemusik.fm")
    ShellExecute("http://www.rautemusik.fm/news.php?section=extreme")
    ElseIf $masta = "ReggaeTrade.fm" Then
    GUICtrlSetData($Label1,"www." & $masta)
    ShellExecute("http://www.radioreggaetrade.com/")
    ElseIf $masta = "HardeR - Rautemusik" Then
    GUICtrlSetData($Label1,"www.Rautemusik.fm")
    ShellExecute("http://www.rautemusik.fm/news.php?section=harder")
    ElseIf $masta = "DRS 1" Then
    GUICtrlSetData($Label1,"www.DRS1.ch")
    ShellExecute("http://www.DRS1.ch")
    ElseIf $masta = "DRS 2" Then
    GUICtrlSetData($Label1,"www.DRS2.ch")
    ShellExecute("http://www.DRS2.ch")
    ElseIf $masta = "DRS 3" Then
    GUICtrlSetData($Label1,"www.DRS3.ch")
    ShellExecute("http://www.DRS3.ch")
    ElseIf $masta = "Radio Grischa" Then
    GUICtrlSetData($Label1,"www.RadioGrischa.ch")
    ShellExecute("http://www.RadioGrischa.ch")
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $fileitem2
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $fileitem
    _About()

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $Volume
    SoundSetWaveVolume(GUICtrlRead($Volume))
    GUICtrlSetData($Labelvolume,GUICtrlRead($volume) & "%")

    [/autoit] [autoit][/autoit] [autoit]

    EndSelect
    WEnd
    exit
    EndFunc ; --> _Main

    [/autoit] [autoit][/autoit] [autoit]

    Func _About()
    Local $Form2, $GroupBox1, $Image1, $Label1, $Label2, $Label3

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("About", 200, 174, 400, 235)
    $Label1 = GUICtrlCreateLabel("InternetRadio", 25, 32, 104, 22, $WS_GROUP)
    GUICtrlSetFont(-1, 11, 400, 2, "Century Gothic")
    $Label2 = GUICtrlCreateLabel("Version 1.2", 24, 64, 83, 22, $WS_GROUP)
    GUICtrlSetFont(-1, 11, 400, 2, "Century Gothic")
    $Label3 = GUICtrlCreateLabel("by Troin", 24, 96, 104, 22)
    GUICtrlSetFont(-1, 11, 400, 2, "Century Gothic")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    local $msg
    $msg = GUIGetMsg()
    Select
    case $msg = $GUI_EVENT_CLOSE
    GUIDelete("About")
    ExitLoop
    EndSelect
    wend
    EndFunc

    [/autoit]


    Du darfst nicht erst die Statusbar und dann das Menü definieren . Die Reihenfolge ist wichtig.