Felder nach Eingabe prüfen

  • Hallo,

    ich habe folgendes Problem:
    Es müssen etliche Daten erfasst werden.

    Ich möchte gerne folgendes machen:

    Das Feld das den Focus hat (soll automatisch prüfen) ob Text enthalten ist.
    Wenn JA , dann geht es nach 2 Sekunden mit TAB zum nächsten Feld!


    Ich habe m. ControlFocus u.s.w. probiert
    alles ohne Erfolg

    Spoiler anzeigen
    [autoit]


    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

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

    $Form1_1 = GUICreate("Form1", 615, 484, 192, 124)
    $txtJahr = GUICtrlCreateInput("2014", 128, 48, 49, 32)
    GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
    $txtOrdner = GUICtrlCreateInput("", 128, 112, 441, 32)
    GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
    $txtDatei = GUICtrlCreateInput("", 128, 168, 441, 32)
    GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
    $txtAdresse = GUICtrlCreateInput("", 128, 224, 441, 32)
    GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
    $txtKopie = GUICtrlCreateInput("", 128, 352, 441, 32)
    GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
    $Label1 = GUICtrlCreateLabel("Jahr:", 72, 48, 45, 28)
    GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
    $lblOrdner = GUICtrlCreateLabel("Ordner", 48, 112, 64, 28, $SS_RIGHT)
    GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
    $lblDatei = GUICtrlCreateLabel("Datei", 69, 167, 46, 28, $SS_RIGHT)
    GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
    $lblAdresse = GUICtrlCreateLabel("Adresse", 38, 232, 74, 28, $SS_RIGHT)
    GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
    $lblKopie = GUICtrlCreateLabel("Kopie", 56, 354, 53, 28, $SS_RIGHT)
    GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
    $btnEnde = GUICtrlCreateButton("beenden", 496, 416, 75, 25)
    $btnStart = GUICtrlCreateButton("Start", 496, 40, 75, 41)
    GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
    GUISetState(@SW_SHOW)

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

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

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

    Case $txtJahr
    ;Send ("{Tab}")
    Case $txtOrdner
    Case $txtDatei
    Case $txtAdresse
    Case $txtKopie

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

    Case $btnEnde
    Exit
    Case $btnStart
    EndSwitch
    WEnd

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


    Grüße
    Ilse ;)

    3 Mal editiert, zuletzt von Ilse (14. Februar 2014 um 13:30)

  • Ich habe mal etwas zusammengebastelt das hoffentlich deinen Vorstellungen aber nicht ganz deiner Beshcreibung entspricht. Nebenbei habe ich noch dein Script visuell etwas aufgeräumt und ein Font ausgewählt das nicht schrecklich aussieht wenn man es zu sehr vergrößert. ;)

    Spoiler anzeigen
    [autoit]

    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <Winapi.au3>

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

    Global $iFocusSwitchTime = 2000, $iFocusID

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

    $Form1_1 = GUICreate("Form1", 615, 484, 192, 124)
    $btnEnde = GUICtrlCreateButton("beenden", 496, 416, 75, 25)
    GUISetFont(16, 400, 0, "Segoe UI", $Form1_1)
    $iCtrl_TabSwitchStart = GUICtrlCreateDummy()
    $txtJahr = GUICtrlCreateInput("2014", 128, 48, 59, 32)
    $txtOrdner = GUICtrlCreateInput("", 128, 112, 441, 32)
    $txtDatei = GUICtrlCreateInput("", 128, 168, 441, 32)
    $txtAdresse = GUICtrlCreateInput("", 128, 224, 441, 32)
    $txtKopie = GUICtrlCreateInput("", 128, 352, 441, 32)
    $iCtrl_TabSwitchEnd = GUICtrlCreateDummy()
    $btnStart = GUICtrlCreateButton("Start", 496, 40, 75, 41)
    GUISetFont(14, 400, 0, "Segoe UI", $Form1_1)
    $Label1 = GUICtrlCreateLabel("Jahr:", 72, 48, 45, 28)
    $lblOrdner = GUICtrlCreateLabel("Ordner", 48, 112, 64, 28, $SS_RIGHT)
    $lblDatei = GUICtrlCreateLabel("Datei", 69, 167, 46, 28, $SS_RIGHT)
    $lblAdresse = GUICtrlCreateLabel("Adresse", 38, 232, 74, 28, $SS_RIGHT)
    $lblKopie = GUICtrlCreateLabel("Kopie", 56, 354, 53, 28, $SS_RIGHT)
    GUISetState()

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

    GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")

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

    While True
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE, $btnEnde
    Exit
    Case $btnStart

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

    EndSwitch
    WEnd

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

    Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hwnd, $iMsg, $wParam, $lParam
    Local $iControlMsg = BitShift($wParam, 16)
    Local $iControlID = BitAND($wParam, 0xFFFF)

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

    Switch $iControlMsg
    Case $EN_CHANGE
    If $iFocusID = $iControlID Then
    AdlibUnRegister("_FocusTimer")
    If GUICtrlRead($iControlID) <> "" Then AdlibRegister("_FocusTimer", $iFocusSwitchTime)
    EndIf
    Case $EN_SETFOCUS
    AdlibUnRegister("_FocusTimer")
    $iFocusID = $iControlID
    EndSwitch
    EndFunc

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

    Func _FocusTimer()
    If $iFocusID >= $iCtrl_TabSwitchStart And $iFocusID < $iCtrl_TabSwitchEnd Then ControlFocus($Form1_1, "", $iFocusID + 1)
    AdlibUnRegister("_FocusTimer")
    EndFunc

    [/autoit]


    $iFocusSwitchTime gibt an wie viel Zeit nach einer Textveränderung im Input bleibt bis gewechselt wird. Der Timer setzt sich nach einer Eingabe im fokussierten Control wieder zurück und wird bei manuellem Fokuswechsel beendet.

  • Hallo,

    muß mich leider wieder melden.
    Habe ein kleines Problem mit dem Script.

    Ich mußte anstatt eines Textfeldes ein Editfeld benutzen
    Das wird aber nicht angesprungen!

    [autoit]


    $txtStichwortsuche = GUICtrlCreateEdit("", 144, 280, 393, 129, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
    GUICtrlSetData(-1, "")

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

    Eine Idee warum?

    Liebe Grüße
    Ilse ;)

  • Hallo Schnitzel,

    so habe mal ein Beispiel gemacht!

    1. Text in Feld eintippen
    2. Cursur springt weiter....

    ABER ins Edit Feld wird nicht gesprungen!
    Da soll er bleiben!

    Spoiler anzeigen
    [autoit]


    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    Opt("GUIResizeMode", $GUI_DOCKAUTO)

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

    Global $iFocusSwitchTime = 1000, $iFocusID

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

    #Region ### START Koda GUI section ### Form=c:\users\personal-1\steuer\steuern-4.kxf
    $Form1_1 = GUICreate("McCanyon-Canon PDF Scanner", 615, 760, 192, 124, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP))
    GUISetFont(8, 800, 0, "System")
    $Dokument = GUICtrlCreateGroup("Dokument-Infos", 16, 16, 577, 409)
    GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
    $iCtrl_TabSwitchStart = GUICtrlCreateDummy()
    $txtJahr = GUICtrlCreateInput("2013", 144, 56, 145, 56, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
    GUICtrlSetFont(-1, 30, 800, 0, "Verdana")
    GUICtrlSetColor(-1, 0x008080)
    $txtDatum = GUICtrlCreateInput("01.12.2013", 328, 56, 209, 46, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
    GUICtrlSetFont(-1, 24, 400, 0, "Verdana")
    $txtVon = GUICtrlCreateInput("", 144, 136, 393, 31)
    GUICtrlSetFont(-1, 14, 400, 0, "Verdana")
    $txtDoc = GUICtrlCreateInput("", 144, 176, 393, 31)
    GUICtrlSetFont(-1, 14, 400, 0, "Verdana")
    $txtBetrag = GUICtrlCreateInput("", 144, 216, 265, 56)
    GUICtrlSetFont(-1, 30, 800, 0, "Verdana")
    GUICtrlSetColor(-1, 0xFF0000)
    $lblJahr = GUICtrlCreateLabel("Jahr", 80, 64, 44, 27, $SS_RIGHT)
    GUICtrlSetFont(-1, 14, 400, 0, "Verdana")
    $lblVon = GUICtrlCreateLabel("Von/Adresse", 24, 136, 107, 22, $SS_RIGHT)
    GUICtrlSetFont(-1, 12, 400, 0, "Verdana")
    $lblDoc = GUICtrlCreateLabel("Dokument", 32, 176, 102, 27, $SS_RIGHT)
    GUICtrlSetFont(-1, 14, 400, 0, "Verdana")
    $lblDatum = GUICtrlCreateLabel("vom", 288, 64, 33, 24, $SS_RIGHT)
    $lblBetrag = GUICtrlCreateLabel("Betrag", 80, 232, 52, 24, $SS_RIGHT)
    $lblEUR = GUICtrlCreateLabel("EUR", 432, 232, 39, 24)
    GUICtrlCreateLabel("Stichwortsuche", 24, 280, 113, 24, $SS_RIGHT)
    $txtSuche = GUICtrlCreateEdit("", 144, 280, 393, 129, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
    GUICtrlSetData(-1, "")
    $iCtrl_TabSwitchEnd = GUICtrlCreateDummy()
    $btnleeren = GUICtrlCreateButton("leeren", 32, 384, 99, 25)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Label1 = GUICtrlCreateLabel(".pdf", 544, 168, 35, 28)
    GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
    $Abteilungen = GUICtrlCreateGroup("Scan an Abteilung", 16, 440, 577, 273)
    GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
    GUICtrlSetBkColor(-1, 0xFFFBF0)
    $btnSonstiges = GUICtrlCreateButton("1", 66, 480, 475, 73)
    GUICtrlSetFont(-1, 12, 800, 0, "Verdana")
    $btnAblage = GUICtrlCreateButton("2", 64, 560, 475, 65)
    GUICtrlSetFont(-1, 16, 800, 0, "Verdana")
    $btnBuchen = GUICtrlCreateButton("3", 64, 632, 475, 65)
    GUICtrlSetFont(-1, 16, 800, 0, "Verdana")
    GUICtrlSetColor(-1, 0x008000)
    $Radio1 = GUICtrlCreateRadio("Simplex", 184, 440, 113, 25)
    GUICtrlSetState(-1, $GUI_CHECKED)
    GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
    $Radio2 = GUICtrlCreateRadio("Duplex", 320, 440, 113, 25)
    GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $beenden = GUICtrlCreateButton("beenden", 520, 720, 75, 25)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")

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

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

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

    Case $btnleeren
    Case $btnSonstiges
    Case $btnAblage
    Case $btnBuchen
    Case $Radio1
    Case $Radio2
    Case $beenden
    EndSwitch
    WEnd

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

    Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hwnd, $iMsg, $wParam, $lParam
    Local $iControlMsg = BitShift($wParam, 16)
    Local $iControlID = BitAND($wParam, 0xFFFF)

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

    Switch $iControlMsg
    Case $EN_CHANGE
    If $iFocusID = $iControlID Then
    AdlibUnRegister("_FocusTimer")
    If GUICtrlRead($iControlID) <> "" Then AdlibRegister("_FocusTimer", $iFocusSwitchTime)
    EndIf
    Case $EN_SETFOCUS
    AdlibUnRegister("_FocusTimer")
    $iFocusID = $iControlID
    EndSwitch
    EndFunc

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

    Func _FocusTimer()
    If $iFocusID >= $iCtrl_TabSwitchStart And $iFocusID < $iCtrl_TabSwitchEnd Then ControlFocus($Form1_1, "", $iFocusID + 1)
    AdlibUnRegister("_FocusTimer")
    EndFunc

    [/autoit]

    Also, der Cursur soll in jedes Textfeld/Editfeld wandern

    Liebe Grüße
    Ilse ;)

  • Du solltest versuchen die Lösungen die dir gegeben werden auch zu verstehen. Sonst wirst du bei jeder kleinen Änderung ein Problem haben.
    Schuld dass es nicht funktioniert ist allein die Reihenfolge in der du die Controls erstellst.
    So wie es name22 gebastelt hat wird für alle Controls zwischen $iCtrl_TabSwitchStart und $iCtrl_TabSwitchEnd bei einer Eingabe weitergesprungen.
    d.h. zwischen der erstellung der DummyControls müssen die "Eingabe"-Controls in der richtigen Reihenfolge erstellt werden.
    Labels haben da nichts zu suchen.

    Ich poste jetzt mal nicht die Lösung und hoffe du kommst selbst drauf.

  • Hallo Schnitzel,

    merci für deine Hilfe.
    Ich probiere ja schon den ganzen morgen da rum.
    Dass es irgendwie mit
    $iCtrl_TabSwitchStart und $iCtrl_TabSwitchEnd
    und den Feldern dazwischen zu tun hat dachte ich mir schon.

    Aber auf Labelfelder hatte ich nicht geachtet!

    Jedenfalls DANKE!!!!
    Es klappt.

    Liebe Grüße
    Ilse ;)