Gui wird nicht angezeigt

  • Hi Leute,

    hab ein Problem mit meinem Script


    ich führe das aus: Dropdown_feed()

    danach sollte dann


    ;Ausgabe Dropdown
    GUICtrlSetData($dropdown, $dropdownlist)
    ;Gui Starten
    GUISetState()

    Passieren aber due Gui wird nicht gestartet ... weiß jemand wieso? es gibt auch keine Fehler

    [autoit]

    #include <File.au3>
    #include <Array.au3>
    #include <GuiListView.au3>
    #include <GUIConstantsEx.au3>
    #include <Excel.au3>
    ;--------------------------------------------------------------------------------
    ;Globale Variablen
    ;--------------------------------------------------------------------------------

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

    Global $dropdownlist[1], $bzpath
    $bzpath = @ScriptDir & "\test.xlsx"

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

    ;--------------------------------------------------------------------------------
    ;Program Start
    ;--------------------------------------------------------------------------------

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

    Gui()

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

    ;--------------------------------------------------------------------------------
    ;Funktions
    ;--------------------------------------------------------------------------------
    ;#######################################################################################################################
    ;--------------------------------------------------------------------------------
    ;Gui
    ;--------------------------------------------------------------------------------
    ;########################################################################################################################

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

    Func Gui()
    ;Lokale Variablen
    Local $msg, $dropdown
    ;Gui anlegen
    GUICreate("E und M Dokumente", 800,450)
    ;Label Anlegen
    $welcome = GUICtrlCreateLabel("Wählen Sie das entsprechende BZ aus:", 10, 10, 310, 40)
    ;Dropdown Box anlegen
    $dropdown = GUICtrlCreateCombo("", 10, 40, 200, 20)
    ;Dropdown Füllen
    Dropdown_feed()
    ;Ausgabe Dropdown
    GUICtrlSetData($dropdown, $dropdownlist)
    ;Gui Starten
    GUISetState()
    ;Warte schleife was passiert
    $msg = 0
    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    EndSelect
    WEnd
    EndFunc

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

    ;#######################################################################################################################
    ;--------------------------------------------------------------------------------
    ;Gui
    ;--------------------------------------------------------------------------------
    ;########################################################################################################################

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

    Func Dropdown_feed()
    $excelfile = _ExcelBookOpen($bzpath,0)
    ;$excelfile = _ExcelReadSheetToArray($bzpath)
    ;Prüfen ob Excel Datei vorhanden ist
    If @error = 1 Then
    MsgBox(0, "Fehler!", "Das Excel-Objekt konnte nicht erstellt werden")
    Exit ElseIf @error = 2 Then
    MsgBox(0, "Fehler!", "Die Datei existiert nicht!")
    Exit
    EndIf

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

    $aArray = _ExcelReadSheetToArray($excelfile)
    _ExcelBookClose($excelfile)
    ;_ArrayDisplay($aArray, "Das Array benutzt die vorgegebenen Parameter")

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

    For $i = 0 To UBound($aArray)-1
    $temp = "BZ - " & $aArray[$i]
    _ArrayAdd($dropdownlist,$temp)
    Next
    EndFunc

    [/autoit]

    Einmal editiert, zuletzt von holzfelix (15. Februar 2013 um 14:30)

  • Also bei mir wird die Gui Angezeigt.
    Auserdem, was für einen browser verwendest du?
    Die Autoit Code Formatieren hats dir ja total verhauen

    Ich hoffe die Formatierung Stimmt so
    [autoit]


    #include <File.au3>
    #include <Array.au3>
    #include <GuiListView.au3>
    #include <GUIConstantsEx.au3>
    #include <Excel.au3>
    ;--------------------------------------------------------------------------------
    ;Globale Variablen
    ;--------------------------------------------------------------------------------
    Global $dropdownlist[1]
    Global $bzpath = @ScriptDir & "\test.xlsx"
    ;--------------------------------------------------------------------------------
    ;Program Start
    ;--------------------------------------------------------------------------------
    Gui()
    ;--------------------------------------------------------------------------------
    ;Funktions;--------------------------------------------------------------------------------
    ;#######################################################################################################################
    ;--------------------------------------------------------------------------------
    ;Gui
    ;--------------------------------------------------------------------------------
    ;########################################################################################################################
    Func Gui()
    ;Lokale Variablen
    Local $msg, $dropdown
    ;Gui anlegen
    $hGui = GUICreate("E und M Dokumente", 800, 450)
    ;Label Anlegen
    $welcome = GUICtrlCreateLabel("Wählen Sie das entsprechende BZ aus:", 10, 10, 310, 40)
    ;Dropdown Box anlegen
    $dropdown = GUICtrlCreateCombo("", 10, 40, 200, 20)
    ;Dropdown Füllen
    Dropdown_feed()
    ;Ausgabe Dropdown
    GUICtrlSetData($dropdown, $dropdownlist)
    ;Gui Starten
    GUISetState()
    ;Warte schleife was passiert
    $msg = 0
    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    EndSelect
    WEnd

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

    $aArray = _ExcelReadSheetToArray($excelfile)
    _ExcelBookClose($excelfile)
    ;~_ArrayDisplay($aArray, "Das Array benutzt die vorgegebenen Parameter")

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

    For $i = 0 To UBound($aArray) - 1
    $temp = "BZ - " & $aArray[$i]
    _ArrayAdd($dropdownlist, $temp)
    Next
    EndFunc ;==>Gui

    [/autoit]


    Versuche mal Zeile 36 wiefolgt zu ändern

    [autoit]

    GUISetState(@SW_SHOW,$hGui)

    [/autoit]


    Dabei nicht vergessen Zeile 26 zu

    [autoit]

    $hGui = GUICreate("E und M Dokumente", 800, 450)

    [/autoit]


    ändern.

    Generell empfehle ich dir aber einen Gui aufbau wie diesen zu verwenden
    [autoit]


    #include <GuiConstants.au3>
    #include <Constants.au3> ;| Eigentlich nicht nötig bei dieser einfachen Gui
    #include <WindowsConstants.au3> ;| Da ich aber meistens ausbaue
    #include <StaticConstants.au3> ;| Werden bei mir diese Includes automatisch bei erstellen eines Scriptes neu Hinzugefügt

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

    $hGui = GUICreate('Demo Gui',360,200,-1,-1)

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

    GUISetState(@SW_SHOW,$hGui)

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

    While 1
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

    [/autoit]

    Greez
    Skilkor