GuiDelete und neu erzeugen?

  • Hallo,

    ich habe ein kleines Problem mit einer Gui!
    ich möchte die Gui löschen (mit ComboBox)
    und anschließend neu anlegen.

    Spoiler anzeigen
    [autoit]


    #include <ButtonConstants.au3>
    #include <ComboConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    Opt("GUIOnEventMode", 1)

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

    $Form1 = GUICreate("Form1", 785, 231, 213, 103)
    $Auswahl = GUICtrlCreateCombo("Auswahl", 420, 56, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "Neu")
    GUICtrlSetOnEvent(-1, "_Checkbox")
    $Start = GUICtrlCreateButton("Start", 44, 56, 131, 25)
    $Input1 = GUICtrlCreateInput("Input1", 44, 92, 133, 21)
    $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 244, 56, 97, 17)
    $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 244, 84, 97, 17)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

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

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

    Case $Auswahl
    Case $Start
    EndSwitch
    WEnd

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

    Func _Checkbox()
    GUIDelete($Form1)
    MsgBox(0,"","")
    ;Form nochmal neu erzugen

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

    endfunc

    [/autoit]

    Mit der Neuanlage der Form mit Objekten komme ich irgendwie nicht weiter.
    Wie kann man das machen?

    Liebe Grüße
    Ilse ;)

    Einmal editiert, zuletzt von Ilse (21. Juli 2011 um 20:05)

  • Hi,

    das geht gaaaanz einfach per Funktion, ich habs hier mal eingebaut:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <ComboConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    Global $Form1
    _start_func()
    Func _start_func()
    $Form1 = GUICreate("Form1", 785, 231, 213, 103)
    $Auswahl = GUICtrlCreateCombo("Auswahl", 420, 56, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "Neu")
    GUICtrlSetOnEvent(-1, "_Checkbox")
    $Start = GUICtrlCreateButton("Start", 44, 56, 131, 25)
    $Input1 = GUICtrlCreateInput("Input1", 44, 92, 133, 21)
    $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 244, 56, 97, 17)
    $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 244, 84, 97, 17)
    GUISetState(@SW_SHOW)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Auswahl
    Case $Start
    _Checkbox()
    EndSwitch
    WEnd
    EndFunc
    Func _Checkbox()
    GUIDelete($Form1)
    MsgBox(0,"","Form wird neu erzeugt...")
    _start_func()
    Endfunc

    [/autoit]


    Da wird die alte Form gelöscht und das Script springt wieder zum Anfang und generiert die Form neu.
    Ich hoffe das ist das was du suchtest.

    mfg
    hauke96