Input liefter falschen Rückgabewert

  • hallo bei folgender GUI habe ich ein problem:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    Global $Form1 = GUICreate("Form1", 326, 107, 192, 124)
    Global $Input1 = GUICtrlCreateInput("Input1", 40, 22, 141, 21)
    Global $Button1 = GUICtrlCreateButton("Button1", 218, 18, 81, 37, $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($Input1) = "" Then
    MsgBox(0, "", "leer")
    Else
    MsgBox(0, "", "voll")
    EndIf
    EndSwitch
    WEnd

    [/autoit]

    an sicht funktioniert es ja...aber wenn ich zb ein leerzeichen in den Input mache kommt als Rückgabewert trotzdem voll

    ich stehe grade irgendwie aufm Schlauch :D
    wäre cool wenn jemand ne lösung findet

    Einmal editiert, zuletzt von Reaker (1. März 2010 um 19:22)

  • Eine Leertaste ist ja auch Inhalt, von daher ist es richtig das voll kommt.

    So geht es auch richtig mit Leerzeichen:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    Global $Form1 = GUICreate("Form1", 326, 107, 192, 124)
    Global $Input1 = GUICtrlCreateInput("Input1", 40, 22, 141, 21)
    Global $Button1 = GUICtrlCreateButton("Button1", 218, 18, 81, 37, $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
    $test = StringStripWS(GUICtrlRead($Input1), 1)
    If $test = "" Then
    MsgBox(0, "", "leer")
    Else
    MsgBox(0, "", "voll")
    EndIf
    EndSwitch
    WEnd

    [/autoit]

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.

  • Warst du schnell habs oben noch reineditiert.

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.

  • oke cool das geht jetzt schonmal..
    jetzt kommt aber noch was :D
    wenn ich jetzt zb schreibe [Leer]Test dann kommt auch wieder voll...ist ja in diesem fall auch logisch aber wie kann ich da auch noch leer zurückgeben?

  • Meinst das so:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    Global $Form1 = GUICreate("Form1", 326, 107, 192, 124)
    Global $Input1 = GUICtrlCreateInput("Input1", 40, 22, 141, 21)
    Global $Button1 = GUICtrlCreateButton("Button1", 218, 18, 81, 37, $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
    $test = StringLeft (GUICtrlRead($Input1), 1)
    If $test = "" OR $test = " " Then
    MsgBox(0, "", "leer")
    Else
    MsgBox(0, "", "voll")
    EndIf
    EndSwitch
    WEnd

    [/autoit]

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.