func stoppen

  • Hallo


    ich habe mir ein paar Gui erstellt die eine Abfrage mit Radio button starten.

    ich möchte aber das man nur auf weiter klicken kann, wenn eine Radio button gecheckt ist. das will ich mit einer if bedingung machen und einer msgbox die einen Hinweis gibt, dass eine Auswahl getroeffen werden muss. Klickt man aber auf OK dann geht die Fun weiter, weil sie dann auf Exitloop trifft. Gibt es einen Befehl der das verhindert?


    und noch was, ich will das die Gui immer im Vordergrund, auch wenn man auf ein anderes Fenster klickt. Such mich aber blöd. mit WinsetonTOP in der Gui, bricht die immer ab.

  • Spoiler anzeigen

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 145, 156, 415, 160)
    $Radio1 = GUICtrlCreateRadio("Radio1", 8, 24, 113, 17)
    $Radio2 = GUICtrlCreateRadio("Radio2", 8, 48, 113, 17)
    $Button1 = GUICtrlCreateButton("Button1", 24, 96, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    case $Button1
    if GUICtrlRead($Radio1) = $GUI_unchecked And GUICtrlRead($Radio2) = $GUI_unchecked Then
    MsgBox(0,"","auswahl treffen")
    EndIf
    Exit

    EndSwitch
    WEnd

  • Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 145, 156, 415, 160)
    $Radio1 = GUICtrlCreateRadio("Radio1", 8, 24, 113, 17)
    $Radio2 = GUICtrlCreateRadio("Radio2", 8, 48, 113, 17)
    $Button1 = GUICtrlCreateButton("Button1", 24, 96, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    case $Button1
    if GUICtrlRead($Radio1) = $GUI_unchecked And GUICtrlRead($Radio2) = $GUI_unchecked Then
    MsgBox(0,"","auswahl treffen")
    ElseIf GUICtrlRead($Radio1) = $GUI_checked Then
    Run('cmd /k ipconfig')
    ElseIf GUICtrlRead($Radio2) = $GUI_checked Then
    Run('cmd /k ping localhost -n 1')
    EndIf

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

    EndSwitch
    WEnd

    [/autoit]


    So in etwa?

    21 is only half the truth.

  • Danke aber das meine ich nicht.

    ich will einfach das die gui nicht beendet wird, wenn keine Auswahl getroffen wurde.

  • Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 145, 156, 415, 160)
    $Radio1 = GUICtrlCreateRadio("Radio1", 8, 24, 113, 17)
    $Radio2 = GUICtrlCreateRadio("Radio2", 8, 48, 113, 17)
    $Button1 = GUICtrlCreateButton("Button1", 24, 96, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    case $Button1
    if GUICtrlRead($Radio1) = $GUI_unchecked And GUICtrlRead($Radio2) = $GUI_unchecked Then
    MsgBox(0,"","auswahl treffen")
    EndIf
    Exit ; Dann würde ich doch einfach das rausnehmen ;)

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

    EndSwitch
    WEnd

    [/autoit]

    Achso und mit

    [autoit]

    WinSetOnTop("Form1","",1)

    [/autoit]

    bekommste die Geschichte in den Vordergrund.

    Nachtrag:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 145, 156, 415, 160)
    $Radio1 = GUICtrlCreateRadio("Radio1", 8, 24, 113, 17)
    $Radio2 = GUICtrlCreateRadio("Radio2", 8, 48, 113, 17)
    $Button1 = GUICtrlCreateButton("Button1", 24, 96, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    WinSetOnTop("Form1","",1)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    case $Button1
    if GUICtrlRead($Radio1) = $GUI_unchecked And GUICtrlRead($Radio2) = $GUI_unchecked Then
    MsgBox(0,"","auswahl treffen")
    ExitLoop
    ElseIf GUICtrlRead($Radio1) = $GUI_checked Then
    Run('cmd /k ipconfig')
    ElseIf GUICtrlRead($Radio2) = $GUI_checked Then
    Run('cmd /k ping localhost -n 1')
    EndIf

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

    EndSwitch
    WEnd

    [/autoit]

    Oder ist es so gemeint? Rufst du das ganze aus einer anderen GUI auf ?

    21 is only half the truth.

  • DAnke mit WinsetonTop geht das jetzt doch, hab wohl nen Denkfehler. Ich versuch das mal ohne exit...

  • DAs geht nicht. Sobald die MSGbox erscheint und ich Ok drücke beendet sich die Gui.