Combo List edit

  • Wie kann man eine Listview so gestalten das wenn ich auf einen eintrag klicke, eine gui aufgeht in der man den eintrag ändern kann?

    (Quellcode geht, wenn play dann auf Vorratskammer klicken.)
    Glaube das GUICtrlSetOnEvent dafür ist. Kann das jemand bestätigen?


    Spoiler anzeigen
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_icon=C:\Users\Fox\Desktop\Koch\index.ico
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

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

    #cs ----------------------------------------------------------------------------

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

    AutoIt Version: 3.3.6.1
    Author: Hans Busch
    Version: 1.0

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

    Script Function:
    Kochbuch

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

    #ce ----------------------------------------------------------------------------

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

    #include <ButtonConstants.au3>
    #include <File.au3>
    #include <GUIConstants.au3>
    #include <GuiStatusBar.au3>
    #include <GUIConstantsEx.au3>
    #include <ProgressConstants.au3>
    #include <SendMessage.au3>
    ;#include <PrintWinAPI.au3>
    #include <ListViewConstants.au3>
    #include <WindowsConstants.au3>
    #include <Array.au3>
    #Include <GuiListView.au3>

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

    FileInstall("Tree.ini", @ScriptDir & "\Tree.ini")

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

    #Region ### START Koda GUI section ### Hauptmenue
    $HauptFenster = GUICreate("Interaktives Kochbusch", 641, 501, Default, Default)
    $HFMDatei = GUICtrlCreateMenu("&Datei")
    $HFMDOffnen = GUICtrlCreateMenuItem("Öffnen", $HFMDatei)
    $HFMDSichern = GUICtrlCreateMenuItem("Sichern", $HFMDatei)
    $HFMDDrucken = GUICtrlCreateMenuItem("Drucken", $HFMDatei)
    $HFMDBeenden = GUICtrlCreateMenuItem("Beenden", $HFMDatei)
    $HFMAnsicht = GUICtrlCreateMenu("&Favorites")
    $HFMAAdminAnsicht = GUICtrlCreateMenuItem("Statistic", $HFMAnsicht)
    $HFMHilfe = GUICtrlCreateMenu("&Hilfe")
    $HFMHInfo = GUICtrlCreateMenuItem("Info", $HFMHilfe)

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

    $Vorratskammer = GUICtrlCreateButton("Vorratskammer", 15 , 15, 105, 425)
    GUICtrlSetFont(-1, 7, 800, 0, "MS Sans Serif")
    GUICtrlSetCursor (-1, 0)
    $RezepteH = GUICtrlCreateButton("Rezepte", 140, 15, 200, 200)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    GUICtrlSetCursor (-1, 0)
    $Rezepte_ErstellenH = GUICtrlCreateButton("Rezepte Schreiben", 390 , 15, 200, 200)
    GUICtrlSetFont(-1, 7, 800, 0, "MS Sans Serif")
    GUICtrlSetCursor (-1, 0)
    $Rezepte_VorschlagenH = GUICtrlCreateButton("Rezepte Vorschlagen", 140, 240, 200, 200)
    GUICtrlSetFont(-1, 7, 800, 0, "MS Sans Serif")
    GUICtrlSetCursor (-1, 0)
    $Rezepte_in_Kalender_vermerkenH = GUICtrlCreateButton("Rezepte in Kalender vermerken", 390, 240, 200, 200)
    GUICtrlSetFont(-1, 7, 800, 0, "MS Sans Serif")
    GUICtrlSetCursor (-1, 0)
    $exit = GUICtrlCreateButton("Beenden", 0, 450, 641, 30)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ### Hauptmenue Ende

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

    #Region ### START Koda GUI section ### VorratskammerFenster
    $VorratskammerFenster = GUICreate("Vorratskammer", 641, 501, Default, Default)
    $HFMDatei = GUICtrlCreateMenu("&Datei")
    $HFMDOffnen = GUICtrlCreateMenuItem("Öffnen", $HFMDatei)
    $HFMDSichern = GUICtrlCreateMenuItem("Sichern", $HFMDatei)
    $HFMDDrucken = GUICtrlCreateMenuItem("Drucken", $HFMDatei)
    $HFMDBeenden = GUICtrlCreateMenuItem("Beenden", $HFMDatei)
    $HFMAnsicht = GUICtrlCreateMenu("&Favorites")
    $HFMAAdminAnsicht = GUICtrlCreateMenuItem("Statistic", $HFMAnsicht)
    $HFMHilfe = GUICtrlCreateMenu("&Hilfe")
    $HFMHInfo = GUICtrlCreateMenuItem("Info", $HFMHilfe)
    $ZurueckVF = GUICtrlCreateButton("Zurück", 0, 450, 641, 30)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    GUICtrlSetCursor (-1, 0)
    $NZH = GUICtrlCreateButton("Neue Zutat hinzufügen", 0, 0, 641, 30)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    GUICtrlSetCursor (-1, 0)
    $Tab1 = GUICtrlCreateTab(15, 40, 620, 400)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
    $TabSheet1 = GUICtrlCreateTabItem("Gewürz")
    $List1 = GUICtrlCreateList("", 20, 70, 605, 365)
    $TabSheet3 = GUICtrlCreateTabItem("Fleich")
    $List2 = GUICtrlCreateList("", 20, 70, 605, 365)
    $TabSheet4 = GUICtrlCreateTabItem("Fisch")
    $List3 = GUICtrlCreateList("", 20, 70, 605, 365)
    $TabSheet5 = GUICtrlCreateTabItem("Wurst")
    $List4 = GUICtrlCreateList("", 20, 70, 605, 365)
    $TabSheet6 = GUICtrlCreateTabItem("Getränke")
    $List5 = GUICtrlCreateList("", 20, 70, 605, 365)
    $TabSheet7 = GUICtrlCreateTabItem("Backware")
    $List6 = GUICtrlCreateList("", 20, 70, 605, 365)
    $TabSheet8 = GUICtrlCreateTabItem("Gemuese")
    $List7 = GUICtrlCreateList("", 20, 70, 605, 365)
    $TabSheet9 = GUICtrlCreateTabItem("Obst")
    $List8 = GUICtrlCreateList("", 20, 70, 605, 365)
    $TabSheet2 = GUICtrlCreateTabItem("Sonstiges")
    $List9 = GUICtrlCreateList("", 20, 70, 605, 365)
    ;GUICtrlSetState(-1,$GUI_SHOW)
    GUICtrlCreateTabItem("")
    #EndRegion ### END Koda GUI section ### VorratskammerFenster Ende

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

    #Region ### START Koda GUI section ### Form=
    $NZIV = GUICreate("Hinzufügen", 240, 205, Default, Default)
    $NAMENZIV = GUICtrlCreateInput("Name", 15, 24, 201, 21)
    $MENGENEINHEITZIV = GUICtrlCreateCombo("Liter", 152, 64, 65, 25)
    GUICtrlSetData(-1, "ml|kg|g|STK")
    $MengeNZIV = GUICtrlCreateInput("Menge", 48, 64, 97, 21)
    $Rubrik = GUICtrlCreateCombo("Gewürz", 15, 96, 201, 25)
    GUICtrlSetData(-1, "Fleisch|Fisch|Wurst|Getränk|Backware|Gemuese|Obst|Sonstiges")
    $HinzufuegenNZIV = GUICtrlCreateButton("Hinzufügen", 15, 128, 203, 25, 0)
    ;$ZurueckNZIV = GUICtrlCreateButton("Zurück", 14, 157, 203, 25)
    #EndRegion ### END Koda GUI section ###

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

    #Region ### START Koda GUI section ### REZEPTE
    $REZEPTEFenster = GUICreate("Kochbuch", 641, 501, Default, Default)
    $HFMDatei = GUICtrlCreateMenu("&Datei")
    $HFMDOffnen = GUICtrlCreateMenuItem("Öffnen", $HFMDatei)
    $HFMDSichern = GUICtrlCreateMenuItem("Sichern", $HFMDatei)
    $HFMDDrucken = GUICtrlCreateMenuItem("Drucken", $HFMDatei)
    $HFMDBeenden = GUICtrlCreateMenuItem("Beenden", $HFMDatei)
    $HFMAnsicht = GUICtrlCreateMenu("&Favorites")
    $HFMAAdminAnsicht = GUICtrlCreateMenuItem("Statistic", $HFMAnsicht)
    $HFMHilfe = GUICtrlCreateMenu("&Hilfe")
    $HFMHInfo = GUICtrlCreateMenuItem("Info", $HFMHilfe)
    $ZurueckHR = GUICtrlCreateButton("Zurück", 0, 450, 641, 30)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    GUICtrlSetCursor (-1, 0)
    $hsourcegroupR = GUICtrlCreateGroup("Rezept", 200, 5, 430, 430)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $hsourcegroupR = GUICtrlCreateGroup("Rezepte", 15, 5, 180, 430)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $TreeView1 = GUICtrlCreateTreeView(20, 25, 170, 400)
    #EndRegion ### END Koda GUI section ### REZEPTE ENDE

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

    #Region ### START Koda GUI section ### REZEPTE Ernstellen
    $REZEPTEeFenster = GUICreate("Kochbuch", 641, 501, Default, Default)
    $HFMDatei = GUICtrlCreateMenu("&Datei")
    $HFMDOffnen = GUICtrlCreateMenuItem("Öffnen", $HFMDatei)
    $HFMDSichern = GUICtrlCreateMenuItem("Sichern", $HFMDatei)
    $HFMDDrucken = GUICtrlCreateMenuItem("Drucken", $HFMDatei)
    $HFMDBeenden = GUICtrlCreateMenuItem("Beenden", $HFMDatei)
    $HFMAnsicht = GUICtrlCreateMenu("&Favorites")
    $HFMAAdminAnsicht = GUICtrlCreateMenuItem("Statistic", $HFMAnsicht)
    $HFMHilfe = GUICtrlCreateMenu("&Hilfe")
    $HFMHInfo = GUICtrlCreateMenuItem("Info", $HFMHilfe)
    $ZurueckHRE = GUICtrlCreateButton("Zurück", 0, 450, 641, 30)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Label2C = GUICtrlCreateLabel("Name:", 15, 10, 65, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $Input1C = GUICtrlCreateInput("", 70, 10, 209, 21)
    GUICtrlSetCursor (-1, 5)
    $Label2C = GUICtrlCreateLabel("Rubrick:", 400, 10, 70, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $COMBO1SO = GUICtrlCreateCombo("", 474, 10, 150, 20)
    GUICtrlSetCursor (-1, 5)
    If FileExists(@ScriptDir & "\Tree.ini") Then
    $LINES = IniReadSection(@ScriptDir & "\Tree.ini", "Tree")
    If @error Then
    MsgBox(4096, "", "Es ist ein Fehler aufgetreten. Warscheinlich keine INI Datei vorhanden.")
    Else
    Dim $ALLLINES1SO = ""
    For $I = 1 To $LINES[0][0]
    $ALLLINES1SO &= $LINES[$I][1] & "|"
    Dim $ALLLINES21SO = $ALLLINES1SO
    Next
    GUICtrlSetData($COMBO1SO, $ALLLINES21SO)
    EndIf
    Else
    MsgBox(4096, "Warnung", "Tree.ini does NOT exists")
    EndIf

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

    $hsourcegroupZBA = GUICtrlCreateGroup("Zubereitungsanweißung", 224, 40, 409, 309)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $srcEditorZBA = GUICtrlCreateEdit("", 232, 56, 393, 285)
    GUICtrlSetData(-1, "")
    $hsourcegroupZ = GUICtrlCreateGroup("Zutaten", 8, 40, 209, 409)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $srcEditorZ = GUICtrlCreateEdit("", 16, 56, 193, 385)

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

    $hsourcegroupN = GUICtrlCreateGroup("Notizen", 224, 350, 409, 99)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $srcEditorN = GUICtrlCreateEdit("", 232, 366, 393, 75)
    GUICtrlSetData(-1, "")

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

    #EndRegion ### END Koda GUI section ### REZEPTE Ernstellen ENDE

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE , $exit
    $msgbox = MsgBox(35, "Beenden?","Wollen sie wirklich beenden?")
    If @error Then GUIDelete($hWnd)
    If $msgbox = 6 Then
    Exit
    EndIf
    ;##############################################################
    Case $Vorratskammer
    GUISetState (@SW_HIDE, $HauptFenster)
    GUISetState (@SW_SHOW, $VorratskammerFenster)
    _Aktualisierenvorat()

    Case $HinzufuegenNZIV
    $NEUEKEY = GUICtrlRead($Rubrik)
    $ZutatINI = GUICtrlRead($NAMENZIV)&" "&GUICtrlRead($MengeNZIV)&" "&GUICtrlRead($MENGENEINHEITZIV)
    $LINES = IniReadSection(@ScriptDir & "\Tree.ini", "Vorrat")
    $NRRomdom = Random ( 1 ,9999 , 1 )
    If Not @error Then
    For $I = 1 To $LINES[0][0]
    If $I <> $LINES[0][0] Then
    Else
    IniWrite(@ScriptDir & "\Tree.ini", "Vorrat", $NEUEKEY & $NRRomdom, $ZutatINI)
    EndIf
    Next
    MsgBox(0, "INFO", "Zutat hinzugefügt gespeichert")
    Else
    IniWrite(@ScriptDir & "\Tree.ini", "Vorrat", $NEUEKEY &$NRRomdom , $ZutatINI)
    MsgBox(0, "INFO", "Zutat hinzugefügt gespeichert")
    EndIf
    _Aktualisierenvorat()
    GUISetState (@SW_HIDE, $NZIV)
    GUISetState (@SW_SHOW, $VorratskammerFenster)


    ;Case $ZurueckNZIV
    ;GUISetState (@SW_HIDE, $NZIV)
    ;GUISetState (@SW_SHOW, $VorratskammerFenster)
    Case $NZH
    GUISetState (@SW_HIDE, $VorratskammerFenster)
    GUISetState (@SW_SHOW, $NZIV)

    Case $ZurueckVF
    GUISetState (@SW_HIDE, $VorratskammerFenster)
    GUISetState (@SW_SHOW, $HauptFenster)
    ;##############################################################

    ;##############################################################
    Case $RezepteH
    GUISetState (@SW_HIDE, $HauptFenster)
    GUISetState (@SW_SHOW, $REZEPTEFenster)
    Case $ZurueckHR
    GUISetState (@SW_HIDE, $REZEPTEFenster)
    GUISetState (@SW_SHOW, $HauptFenster)
    ;##############################################################
    Case $Rezepte_ErstellenH
    GUISetState (@SW_HIDE, $HauptFenster)
    GUISetState (@SW_SHOW, $REZEPTEeFenster)
    Case $ZurueckHRE
    GUISetState (@SW_HIDE, $REZEPTEeFenster)
    GUISetState (@SW_SHOW, $HauptFenster)
    ;##############################################################

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


    EndSwitch
    WEnd
    ;MsgBox(4096, "", $LIST1[$S][0] )
    Func _Aktualisierenvorat()
    $LIST1INI = IniReadSection(@ScriptDir & "\Tree.INI", "Vorrat")
    For $S = 1 To $LIST1INI[0][0]

    If 0 <> StringInStr($LIST1INI[$S][0] , "Gewürz" ) Then
    GUICtrlSetData($List1, $LIST1INI[$S][1])
    EndIf
    If 0 <> StringInStr($LIST1INI[$S][0] , "Fleisch") Then
    GUICtrlSetData($List2, $LIST1INI[$S][1])
    EndIf
    If 0 <> StringInStr($LIST1INI[$S][0] , "Fisch" ) Then
    GUICtrlSetData($List3, $LIST1INI[$S][1])
    EndIf
    If 0 <> StringInStr($LIST1INI[$S][0] , "Wurst" ) Then
    GUICtrlSetData($List4, $LIST1INI[$S][1])
    EndIf
    If 0 <> StringInStr($LIST1INI[$S][0] , "Getränke" ) Then
    GUICtrlSetData($List5, $LIST1INI[$S][1])
    EndIf
    If 0 <> StringInStr($LIST1INI[$S][0] , "Backware" ) Then
    GUICtrlSetData($List6, $LIST1INI[$S][1])
    EndIf
    If 0 <> StringInStr($LIST1INI[$S][0] , "Gemuese" ) Then
    GUICtrlSetData($List7, $LIST1INI[$S][1])
    EndIf
    If 0 <> StringInStr($LIST1INI[$S][0] , "Obst" ) Then
    GUICtrlSetData($List8, $LIST1INI[$S][1])
    EndIf
    If 0 <> StringInStr($LIST1INI[$S][0] , "Sonstiges" ) Then
    GUICtrlSetData($List9, $LIST1INI[$S][1])
    EndIf
    Next
    EndFunc ;==>_Aktualisierenvorat

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

    2 Mal editiert, zuletzt von Del (18. Februar 2012 um 21:13) aus folgendem Grund: Ich habe es hinbekommen das ich übers Kontextmenüe was tun kann. Doch wie bekomme ich es hin das genau der inhalt der Zeile genannt wird und nicht die ganze liste?