ComboBox Problem

  • Nächste Frage:


    Kenzeichnung <-----------------------

    Spoiler anzeigen


    #Region ### START Koda GUI section ### Form=C:\Dokumente und Einstellungen\busch.GAIAAKKU\Desktop\JagtSkript.exe\FormSkriptSpeicherort.kxf
    $Form2 = GUICreate("Skriptspeicherort", 402, 201, 203, 193)
    GUISetCursor (2)
    GUISetFont(8, 400, 0, "Arial")
    GUISetBkColor(0x3D95FF)
    $Label2 = GUICtrlCreateLabel("Hir kommt der Path zu den neuen Skript Quellcode rein.", 8, 16, 383, 20)
    GUICtrlSetFont(-1, 10, 800, 4, "MS Sans Serif")
    $Label1 = GUICtrlCreateLabel("Path:", 8, 60, 56, 28)
    GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
    $Input1 = GUICtrlCreateInput("", 70, 60, 300, 22) ;<-----------------------
    GUICtrlSetCursor (-1, 5)
    $Button1 = GUICtrlCreateButton("Speichern", 262, 102, 105, 30)
    GUICtrlSetFont(-1, 8, 800, 4, "Arial")
    GUICtrlSetCursor (-1, 0)
    $Label3 = GUICtrlCreateLabel("zB. c:\....\...\(Ver.1.0)J.euo", 72, 88, 132, 18)
    $Combo1 = GUICtrlCreateCombo("", 70, 160, 300, 22) ;<-----------------------

    If FileExists(@ScriptDir & '\SkriptPathangaben.txt') Then
    $file = FileOpen ( "SkriptPathangaben.txt", 0 )
    If $file = -1 Then
    MsgBox(0, "Error", "Kann Datei nicht Öffnen!")
    Exit
    EndIf
    $AllLines = ""
    While 1
    $line = FileReadLine($file)
    If @error = -1 Then
    StringTrimRight($AllLines, 1)
    ExitLoop
    EndIf
    $AllLines &= $line &"|"
    Dim $AllLines2 = $AllLines
    WEnd
    Else
    MsgBox(4096,"Warnung" , "SkriptPathangaben.txt does NOT exists")
    EndIf
    $Combo1 = GUICtrlSetData(-1, $AllLines2 ) ;<-----------------------
    $Label4 = GUICtrlCreateLabel("Alte Versionen einfach Auswählen.", 70, 136, 76, 22)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Combo1 <-----------------------

    (xxxxxxxxx) <-----------------------Dort ist mein Problem. Inhalt der Combo soll in die Input box copiert werden
    $Path1 = GuiCtrlRead($Combo1)
    GUICtrlSetData ($Input1, $Path1)


    Case $Button1

    $Path = GuiCtrlRead($Input1)
    If FileExists(@ScriptDir & '\SkriptPathangaben.txt') Then
    $file = FileOpen ( "SkriptPathangaben.txt", 1 )
    If $file = -1 Then
    MsgBox(0, "Error", "Kann Datei nicht Öffnen!")
    Exit
    EndIf
    FileWrite($file, @CRLF)
    FileWrite($file, $Path )
    FileClose($file)
    Else
    MsgBox(4096,"Warnung" , "SkriptPathangaben.txt does NOT exists")
    EndIf


    EndSwitch
    WEnd

    Wie gibt man den ausgewählten wehrt einer Combobox sofort an die Input box weiter?

    Hat jemand einen Hinweiß?

  • Wenn Button2 gedrückt wird Soll die in einer Meldung stehen was in der Combobox ausgewählt worden ist.
    Was mach ich Falsch das der Wehrt nicht angezeigt wird?


    Case $Button2
    $auswahl = GUICtrlRead($Combo1)
    MsgBox(4096,"Warnung" , $auswahl )

    Im Ganzen sihr das so aus.

    Spoiler anzeigen


    #include <GUIConstants.au3>

    #Region ### START Koda GUI section ### Form=C:\Dokumente und Einstellungen\busch.GAIAAKKU\Desktop\JagtSkript.exe\FormSkriptSpeicherort.kxf
    $Form2 = GUICreate("Skriptspeicherort", 402, 251, 203, 193)
    GUISetCursor (2)
    GUISetFont(8, 400, 0, "Arial")
    GUISetBkColor(0x3D95FF)
    $Label2 = GUICtrlCreateLabel("Hir kommt der Path zu den neuen Skript Quellcode rein.", 8, 16, 383, 20)
    GUICtrlSetFont(-1, 10, 800, 4, "MS Sans Serif")
    $Label1 = GUICtrlCreateLabel("Path:", 8, 60, 56, 28)
    GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
    $Input1 = GUICtrlCreateInput("", 70, 60, 300, 22)
    GUICtrlSetCursor (-1, 5)
    $Button1 = GUICtrlCreateButton("Speichern", 262, 102, 105, 30)
    GUICtrlSetFont(-1, 8, 800, 4, "Arial")
    GUICtrlSetCursor (-1, 0)
    $Label3 = GUICtrlCreateLabel("zB. c:\....\...\(Ver.1.0)J.euo", 72, 88, 132, 18)
    $Combo1 = GUICtrlCreateCombo("", 70, 160, 300, 22)

    If FileExists(@ScriptDir & '\SkriptPathangaben.txt') Then
    $file = FileOpen ( "SkriptPathangaben.txt", 0 )
    If $file = -1 Then
    MsgBox(0, "Error", "Kann Datei nicht Öffnen!")
    Exit
    EndIf
    $AllLines = ""
    While 1
    $line = FileReadLine($file)
    If @error = -1 Then
    StringTrimRight($AllLines, 1)
    ExitLoop
    EndIf
    $AllLines &= $line &"|"
    Dim $AllLines2 = $AllLines
    WEnd
    Else
    MsgBox(4096,"Warnung" , "SkriptPathangaben.txt does NOT exists")
    EndIf
    $Combo1 = GUICtrlSetData(-1, $AllLines2 )
    $Label4 = GUICtrlCreateLabel("Alte Versionen einfach Auswählen.", 70, 136, 76, 22)
    GUISetState(@SW_SHOW)
    $Button2 = GUICtrlCreateButton("Speichern", 263, 204, 105, 30)
    GUICtrlSetFont(-1, 8, 800, 4, "Arial")
    GUICtrlSetCursor (-1, 0)
    $Label5 = GUICtrlCreateLabel("Oder:", 8, 112, 52, 28)
    GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
    GUISetState(@SW_SHOW)

    #EndRegion ### END Koda GUI section ###

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    Case $Button2
    $auswahl = GUICtrlRead($Combo1)
    MsgBox(4096,"Warnung" , $auswahl )


    Case $Button1

    $Path = GuiCtrlRead($Input1)
    If FileExists(@ScriptDir & '\SkriptPathangaben.txt') Then
    $file = FileOpen ( "SkriptPathangaben.txt", 1 )
    If $file = -1 Then
    MsgBox(0, "Error", "Kann Datei nicht Öffnen!")
    Exit
    EndIf
    FileWrite($file, @CRLF)
    FileWrite($file, $Path )
    FileClose($file)
    Else
    MsgBox(4096,"Warnung" , "SkriptPathangaben.txt does NOT exists")
    EndIf


    EndSwitch
    WEnd

  • Hi,

    bitte das nächste mal den Spoiler UND den Autoit-Quellcode-Button nutzen :)

    Bei dir steht

    [autoit]

    $Combo1 = GUICtrlSetData(-1, $AllLines2)

    [/autoit]


    Aber es muss

    [autoit]

    GUICtrlSetData($Combo1, $AllLines2)

    [/autoit]

    Warum, bei deiner Version überschreibst du den Wert von $Combo1 und das darf man nicht ;)

    Mfg
    Jens (McPoldy)

    Twitter: jkroeger

    Denn die Dinge, die wir erst lernen müssen, bevor wir sie tun, lernen wir beim Tun.(Aristoteles)