GUI-COMBO

  • Hallo

    möchte ien programm schreiben wo aus einer ini meine serials ausließt und dann angibt

    also gui soll so aufgebaut sein combos und lisview

    wie kann ich es jetzt machen wann in der ersten combo nichts ausgewählt ist in der 2ten nichts ist und nichts zum auswählen ist
    wird in der ersten betriebssystem ausgewählt in der 2ten dann windows xp| windows vista ... drin steht
    aber das er es automatisch aktualisiert nicht das man ein button drücken muss das er es ausließt und abändert in der 2ten combo !

    wie muss ich das progen :(

    lg chris

    Einmal editiert, zuletzt von SchrotterCh (8. April 2010 um 08:45)

  • also:

    GUI mit 2 Combos

    Anfang:
    1. Combo leer
    2. Combo leer

    Draufklicken
    1. Combo Betriebssystem
    2. combo leer

    1.Combo Betriebssystem ausgewählt
    2.Combo Windows XP, Windows VIsta , ....

    so war das gemeint das wann in der ersten was ausgewählt wird er das ausließt und dann in der 2ten combo das anzeigt wo dazu eingegeben wurde wo er anzeigen soll

    lg

  • mir war grad langweilig.
    weiß nicht ob ich dich richtig verstanden hab aber hab da was gebastelt.

    Spoiler anzeigen
    [autoit]


    ;~ die iniwrites gehören kannste beim 2ten mal wegmachen^^
    IniWrite("test.ini", "OS", "Win XP", "keyxp-keyxp-keyxp-keyxp-keyxp")
    IniWrite("test.ini", "OS", "Win 7", "key7-key7-key7-key7-key7")
    ;~ lieblingsgames :D
    IniWrite("test.ini", "Games", "Teletubbies", "keytt-keytt-keytt-keytt-keytt")
    IniWrite("test.ini", "Games", "Babies Dreamworld", "keybd-keybd-keybd-keybd-keybd")

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

    #include <GUIConstantsEx.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("", 511, 124, 192, 124)
    $Combo1 = GUICtrlCreateCombo("", 48, 32, 169, 25)
    $Combo2 = GUICtrlCreateCombo("", 272, 32, 169, 25)
    $Label1 = GUICtrlCreateLabel("", 160, 80, 200, 17)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    ;~ Daten setzten
    $aTmp = IniReadSectionNames("test.ini")
    $sTmp = ""
    For $i = 1 To $aTmp[0]
    $sTmp &= $aTmp[$i] & "|"
    Next
    GUICtrlSetData($Combo1, $sTmp)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Combo1
    GUICtrlSetData($Combo2, "")
    $aTmp = IniReadSection("test.ini", Guictrlread($Combo1))
    $sTmp = ""
    For $i = 1 To $aTmp[0][0]
    $sTmp &= $aTmp[$i][0] & "|"
    Next
    GUICtrlSetData($Combo2, $sTmp)
    Case $Combo2
    For $i = 1 To $aTmp[0][0]
    If $aTmp[$i][0] = GUICtrlRead($Combo2) Then ExitLoop
    Next
    GUICtrlSetData($Label1, $aTmp[$i][1])
    EndSwitch
    WEnd

    [/autoit]
  • Hallo
    das mit der combo geht jetzt.
    aber ich hab jetzt ein problem mit der list view er sollte sich immer nach einer neuen auswahl löschen aber er macht es einfach nicht der befehl ist in der Func _Combo_03 an erster stelle und der include ist auch eingebaut bitte helft mir :)
    lg chris

    Spoiler anzeigen
    [autoit]

    ;----------------------------------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------------------------
    ;Teil01 (Allgemein)
    ;----------------------------------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------------------------
    Opt("CaretCoordMode", 1)
    Opt("ExpandEnvStrings", 0)
    Opt("ExpandVarStrings", 0)
    Opt("GUICloseOnESC", 1)
    Opt("GUICoordMode", 1)
    Opt("GUIDataSeparatorChar", "|")
    Opt("GUIOnEventMode", 0)
    Opt("GUIResizeMode", 0)
    Opt("GUIEventOptions", 0)
    Opt("MouseClickDelay", 10)
    Opt("MouseClickDownDelay", 10)
    Opt("MouseClickDragDelay", 250)
    Opt("MouseCoordMode", 1)
    Opt("MustDeclareVars", 0)
    Opt("PixelCoordMode", 1)
    Opt("SendAttachMode", 0)
    Opt("SendCapslockMode", 1)
    Opt("SendKeyDelay", 5)
    Opt("SendKeyDownDelay", 1)
    Opt("TCPTimeout", 100)
    Opt("TrayAutoPause", 0)
    Opt("TrayIconDebug", 1)
    Opt("TrayIconHide", 0)
    Opt("TrayMenuMode", 0)
    Opt("TrayOnEventMode", 0)
    Opt("WinDetectHiddenText", 0)
    Opt("WinSearchChildren", 1)
    Opt("WinTextMatchMode", 1)
    Opt("WinTitleMatchMode", 1)
    Opt("WinWaitDelay", 250)
    ;----------------------------------------------------------------------------------------------------
    #include <EditConstants.au3>
    #Include <File.au3>
    #include <GuiConstantsEx.au3>
    #include <GuiListView.au3>
    #include <ListviewConstants.au3>
    #include <WindowsConstants.au3>
    ;----------------------------------------------------------------------------------------------------
    $INI_Pfad_01 = @ScriptDir & "\Serials.ini"
    ;----------------------------------------------------------------------------------------------------
    Global $GUI_01_Button_01
    Global $GUI_01_Combo_01, $GUI_01_Combo_02, $GUI_01_Combo_03
    Global $GUI_01_Input_01, $GUI_01_Input_02
    Global $GUI_01_ListView_01

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

    Global $GUI_01_ReadCombo_01, $GUI_01_ReadCombo_02
    Global $String_Split_01, $INI_ReadSection_01

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

    ;----------------------------------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------------------------
    ;Teil02 (Programm)
    ;----------------------------------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------------------------
    If FileExists ("Serials.ini") = 1 Then
    Else
    MsgBox (16 + 262144, "Fehler", "Die ''Serials.ini'' ist nicht Vorhanden!" & @CRLF & "''Serials.ini'' wurde erstellt" & @CRLF & "Serials.ini wurde mit Informationen und Grundinformationen beschrieben!" & @CRLF & "Programm wird beendet!")
    _FileCreate ($INI_Pfad_01)
    IniWriteSection ($INI_Pfad_01, "Art", "", "")
    IniWrite ($INI_Pfad_01, "Art", "Programmname", "Serial-Info|Serial-Code|Activierung|Ablaufdatum|Quelle")
    Exit
    EndIf

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

    $GUI_01 = GUICreate ("Serials", 800, 340, -1, -1)
    $GUI_01_Combo_01 = GUICtrlCreateCombo ("", 5, 5, 790, 20, 0x0003)
    $GUI_01_Combo_02 = GUICtrlCreateCombo ("", 5, 30, 790, 20, 0x0003)
    $GUI_01_Combo_03 = GUICtrlCreateCombo ("", 5, 55, 790, 20, 0x0003)
    $GUI_01_ListView_01 = GUICtrlCreateListView ("Art|Serial-Info|Serial-Code|Activierung|Ablaufdatum|Quelle", 5, 85, 790, 140)
    $GUI_01_Label_01 = GUICtrlCreateLabel ("Serialinfo:", 5, 232, 70, 17)
    $GUI_01_Label_02 = GUICtrlCreateLabel ("Serialcode:", 5, 257, 70, 17)
    $GUI_01_Label_03 = GUICtrlCreateLabel ("Activierung:", 5, 282, 70, 17)
    $GUI_01_Input_01 = GUICtrlCreateInput ("", 65, 230, 730, 20, 0x0800)
    $GUI_01_Input_02 = GUICtrlCreateInput ("", 65, 255, 730, 20, 0x0800)
    $GUI_01_Input_03 = GUICtrlCreateInput ("", 65, 280, 730, 20, 0x0800)
    $GUI_01_Button_01 = GUICtrlCreateButton ("Auslesen (markierung)", 5, 305, 392, 30)
    $GUI_01_Button_02 = GUICtrlCreateButton ("Exit", 402, 305, 393, 30)
    _GUICtrlListView_SetColumnWidth ($GUI_01_ListView_01, 0, 130)
    _GUICtrlListView_SetColumnWidth ($GUI_01_ListView_01, 1, 130)
    _GUICtrlListView_SetColumnWidth ($GUI_01_ListView_01, 2, 130)
    _GUICtrlListView_SetColumnWidth ($GUI_01_ListView_01, 3, 130)
    _GUICtrlListView_SetColumnWidth ($GUI_01_ListView_01, 4, 130)
    _GUICtrlListView_SetColumnWidth ($GUI_01_ListView_01, 5, 130)
    _GUICtrlListView_RegisterSortCallBack($GUI_01_ListView_01)
    GUISetState (@SW_SHOW, $GUI_01)

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

    _Load_01 ()

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

    While True
    Switch GUIGetMsg ()
    Case $GUI_EVENT_CLOSE
    Exit

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

    Case $GUI_01_Button_01

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

    MsgBox (0, "", "")

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

    Case $GUI_01_Button_02
    Exit

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

    Case $GUI_01_Combo_01
    _Combo_01 ()

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

    Case $GUI_01_Combo_02
    _Combo_02 ()

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

    Case $GUI_01_Combo_03
    _Combo_03 ()

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

    Case $GUI_01_ListView_01
    _GUICtrlListView_SortItems($GUI_01_ListView_01, GUICtrlGetState($GUI_01_ListView_01))
    EndSwitch
    WEnd
    ;----------------------------------------------------------------------------------------------------
    Func _Load_01 ()
    GUICtrlSetData ($GUI_01_Combo_01, "")
    $INI_ReadSectionNames_01 = IniReadSectionNames ($INI_Pfad_01)
    For $Anzahl_01 = 1 To $INI_ReadSectionNames_01[0] Step 1
    GUICtrlSetData ($GUI_01_Combo_01, $INI_ReadSectionNames_01[$Anzahl_01])
    Next
    EndFunc

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

    Func _Combo_01 ()
    GUICtrlSetData ($GUI_01_Combo_02, "")
    $INI_ReadSection_01 = IniReadSection ($INI_Pfad_01, GUICtrlRead ($GUI_01_Combo_01))
    For $Anzahl_01 = 1 To $INI_ReadSection_01[0][0] Step 1
    GUICtrlSetData ($GUI_01_Combo_02, $INI_ReadSection_01[$Anzahl_01][0])
    Next
    EndFunc

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

    Func _Combo_02 ()
    GUICtrlSetData ($GUI_01_Combo_03, "")
    $INI_ReadSection_01 = IniReadSection ($INI_Pfad_01, GUICtrlRead ($GUI_01_Combo_01))
    For $Anzahl_01 = 1 To $INI_ReadSection_01[0][0] Step 1
    $String_Split_01 = StringSplit ($INI_ReadSection_01[$Anzahl_01][1], "|")
    If $INI_ReadSection_01[$Anzahl_01][0] = GUICtrlRead ($GUI_01_Combo_02) Then
    GUICtrlSetData ($GUI_01_Combo_03, $String_Split_01[1])
    EndIf
    Next
    EndFunc

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

    Func _Combo_03 ()
    _GUICtrlListView_DeleteAllItems ($GUI_01_ListView_01)
    $INI_ReadSection_01 = IniReadSection ($INI_Pfad_01, GUICtrlRead ($GUI_01_Combo_01))
    For $Anzahl_01 = 1 To $INI_ReadSection_01[0][0] Step 1
    $String_Split_01 = StringSplit ($INI_ReadSection_01[$Anzahl_01][1], "|")
    If $INI_ReadSection_01[$Anzahl_01][0] = GUICtrlRead ($GUI_01_Combo_02) And $String_Split_01[1] = GUICtrlRead ($GUI_01_Combo_03) Then
    GUICtrlCreateListViewItem ($INI_ReadSection_01[$Anzahl_01][0] & "|" & $INI_ReadSection_01[$Anzahl_01][1], $GUI_01_ListView_01)
    EndIf
    Next
    EndFunc

    [/autoit]

    INI-Datei ist in der .rar datei beigelegt mit script

    • Offizieller Beitrag

    Bei _GUICtrlListView_DeleteAllItems muß der Control Handle und nicht das ContrlId angegeben werden.

    Spoiler anzeigen
    [autoit]

    ;----------------------------------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------------------------
    ;Teil01 (Allgemein)
    ;----------------------------------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------------------------
    Opt("CaretCoordMode", 1)
    Opt("ExpandEnvStrings", 0)
    Opt("ExpandVarStrings", 0)
    Opt("GUICloseOnESC", 1)
    Opt("GUICoordMode", 1)
    Opt("GUIDataSeparatorChar", "|")
    Opt("GUIOnEventMode", 0)
    Opt("GUIResizeMode", 0)
    Opt("GUIEventOptions", 0)
    Opt("MouseClickDelay", 10)
    Opt("MouseClickDownDelay", 10)
    Opt("MouseClickDragDelay", 250)
    Opt("MouseCoordMode", 1)
    Opt("MustDeclareVars", 0)
    Opt("PixelCoordMode", 1)
    Opt("SendAttachMode", 0)
    Opt("SendCapslockMode", 1)
    Opt("SendKeyDelay", 5)
    Opt("SendKeyDownDelay", 1)
    Opt("TCPTimeout", 100)
    Opt("TrayAutoPause", 0)
    Opt("TrayIconDebug", 1)
    Opt("TrayIconHide", 0)
    Opt("TrayMenuMode", 0)
    Opt("TrayOnEventMode", 0)
    Opt("WinDetectHiddenText", 0)
    Opt("WinSearchChildren", 1)
    Opt("WinTextMatchMode", 1)
    Opt("WinTitleMatchMode", 1)
    Opt("WinWaitDelay", 250)
    ;----------------------------------------------------------------------------------------------------
    #include <EditConstants.au3>
    #include <File.au3>
    #include <GuiConstantsEx.au3>
    #include <GuiListView.au3>
    #include <ListviewConstants.au3>
    #include <WindowsConstants.au3>
    ;----------------------------------------------------------------------------------------------------
    $INI_Pfad_01 = @ScriptDir & "\Serials.ini"
    ;----------------------------------------------------------------------------------------------------
    Global $GUI_01_Button_01
    Global $GUI_01_Combo_01, $GUI_01_Combo_02, $GUI_01_Combo_03
    Global $GUI_01_Input_01, $GUI_01_Input_02
    Global $GUI_01_ListView_01

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

    Global $GUI_01_ReadCombo_01, $GUI_01_ReadCombo_02
    Global $String_Split_01, $INI_ReadSection_01

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

    ;----------------------------------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------------------------
    ;Teil02 (Programm)
    ;----------------------------------------------------------------------------------------------------
    ;----------------------------------------------------------------------------------------------------
    If FileExists("Serials.ini") = 1 Then
    Else
    MsgBox(16 + 262144, "Fehler", "Die ''Serials.ini'' ist nicht Vorhanden!" & @CRLF & "''Serials.ini'' wurde erstellt" & @CRLF & "Serials.ini wurde mit Informationen und Grundinformationen beschrieben!" & @CRLF & "Programm wird beendet!")
    _FileCreate($INI_Pfad_01)
    IniWriteSection($INI_Pfad_01, "Art", "", "")
    IniWrite($INI_Pfad_01, "Art", "Programmname", "Serial-Info|Serial-Code|Activierung|Ablaufdatum|Quelle")
    Exit
    EndIf

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

    $GUI_01 = GUICreate("Serials", 800, 340, -1, -1)
    $GUI_01_Combo_01 = GUICtrlCreateCombo("", 5, 5, 790, 20, 0x0003)
    $GUI_01_Combo_02 = GUICtrlCreateCombo("", 5, 30, 790, 20, 0x0003)
    $GUI_01_Combo_03 = GUICtrlCreateCombo("", 5, 55, 790, 20, 0x0003)
    $GUI_01_ListView_01 = GUICtrlCreateListView("Art|Serial-Info|Serial-Code|Activierung|Ablaufdatum|Quelle", 5, 85, 790, 140)
    $hGUI_01_ListView_01 = GUICtrlGetHandle($GUI_01_ListView_01)
    $GUI_01_Label_01 = GUICtrlCreateLabel("Serialinfo:", 5, 232, 70, 17)
    $GUI_01_Label_02 = GUICtrlCreateLabel("Serialcode:", 5, 257, 70, 17)
    $GUI_01_Label_03 = GUICtrlCreateLabel("Activierung:", 5, 282, 70, 17)
    $GUI_01_Input_01 = GUICtrlCreateInput("", 65, 230, 730, 20, 0x0800)
    $GUI_01_Input_02 = GUICtrlCreateInput("", 65, 255, 730, 20, 0x0800)
    $GUI_01_Input_03 = GUICtrlCreateInput("", 65, 280, 730, 20, 0x0800)
    $GUI_01_Button_01 = GUICtrlCreateButton("Auslesen (markierung)", 5, 305, 392, 30)
    $GUI_01_Button_02 = GUICtrlCreateButton("Exit", 402, 305, 393, 30)
    _GUICtrlListView_SetColumnWidth($GUI_01_ListView_01, 0, 130)
    _GUICtrlListView_SetColumnWidth($GUI_01_ListView_01, 1, 130)
    _GUICtrlListView_SetColumnWidth($GUI_01_ListView_01, 2, 130)
    _GUICtrlListView_SetColumnWidth($GUI_01_ListView_01, 3, 130)
    _GUICtrlListView_SetColumnWidth($GUI_01_ListView_01, 4, 130)
    _GUICtrlListView_SetColumnWidth($GUI_01_ListView_01, 5, 130)
    _GUICtrlListView_RegisterSortCallBack($GUI_01_ListView_01)
    GUISetState(@SW_SHOW, $GUI_01)

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

    _Load_01()

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

    While True
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    Exit

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

    Case $GUI_01_Button_01

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

    MsgBox(0, "", "")

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

    Case $GUI_01_Button_02
    Exit

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

    Case $GUI_01_Combo_01
    _Combo_01()

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

    Case $GUI_01_Combo_02
    _Combo_02()

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

    Case $GUI_01_Combo_03
    _Combo_03()

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

    Case $GUI_01_ListView_01
    _GUICtrlListView_SortItems($GUI_01_ListView_01, GUICtrlGetState($GUI_01_ListView_01))
    EndSwitch
    WEnd
    ;----------------------------------------------------------------------------------------------------
    Func _Load_01()
    GUICtrlSetData($GUI_01_Combo_01, "")
    $INI_ReadSectionNames_01 = IniReadSectionNames($INI_Pfad_01)
    For $Anzahl_01 = 1 To $INI_ReadSectionNames_01[0] Step 1
    GUICtrlSetData($GUI_01_Combo_01, $INI_ReadSectionNames_01[$Anzahl_01])
    Next
    EndFunc ;==>_Load_01

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

    Func _Combo_01()
    GUICtrlSetData($GUI_01_Combo_02, "")
    $INI_ReadSection_01 = IniReadSection($INI_Pfad_01, GUICtrlRead($GUI_01_Combo_01))
    For $Anzahl_01 = 1 To $INI_ReadSection_01[0][0] Step 1
    GUICtrlSetData($GUI_01_Combo_02, $INI_ReadSection_01[$Anzahl_01][0])
    Next
    EndFunc ;==>_Combo_01

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

    Func _Combo_02()
    GUICtrlSetData($GUI_01_Combo_03, "")
    $INI_ReadSection_01 = IniReadSection($INI_Pfad_01, GUICtrlRead($GUI_01_Combo_01))
    For $Anzahl_01 = 1 To $INI_ReadSection_01[0][0] Step 1
    $String_Split_01 = StringSplit($INI_ReadSection_01[$Anzahl_01][1], "|")
    If $INI_ReadSection_01[$Anzahl_01][0] = GUICtrlRead($GUI_01_Combo_02) Then
    GUICtrlSetData($GUI_01_Combo_03, $String_Split_01[1])
    EndIf
    Next
    EndFunc ;==>_Combo_02

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

    Func _Combo_03()
    _GUICtrlListView_DeleteAllItems($hGUI_01_ListView_01)
    $INI_ReadSection_01 = IniReadSection($INI_Pfad_01, GUICtrlRead($GUI_01_Combo_01))
    For $Anzahl_01 = 1 To $INI_ReadSection_01[0][0] Step 1
    $String_Split_01 = StringSplit($INI_ReadSection_01[$Anzahl_01][1], "|")
    If $INI_ReadSection_01[$Anzahl_01][0] = GUICtrlRead($GUI_01_Combo_02) And $String_Split_01[1] = GUICtrlRead($GUI_01_Combo_03) Then
    GUICtrlCreateListViewItem($INI_ReadSection_01[$Anzahl_01][0] & "|" & $INI_ReadSection_01[$Anzahl_01][1], $GUI_01_ListView_01)
    EndIf
    Next
    EndFunc ;==>_Combo_03

    [/autoit]
  • danke :)
    ist das jetzt bei der neuen version das man das so machen muss?
    früher hatt ich es auch nicht drin und soviel ich weiß gings dort noch :S