Windows Rechner nach gebaut Help?

  • Hey ich habe das Script so

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $main = GUICreate("Rechner by Rey96", 388, 383, 192, 124)
    $input_aufgabe = GUICtrlCreateInput("", 16, 56, 353, 21)
    $btn_number1 = GUICtrlCreateButton("1", 48, 96, 43, 41, $WS_GROUP)
    $btn_number2 = GUICtrlCreateButton("2", 144, 96, 41, 41, $WS_GROUP)
    $btn_number3 = GUICtrlCreateButton("3", 240, 96, 43, 41, $WS_GROUP)
    $btn_number4 = GUICtrlCreateButton("4", 48, 168, 43, 41, $WS_GROUP)
    $btn_number5 = GUICtrlCreateButton("5", 144, 168, 43, 41, $WS_GROUP)
    $btn_number6 = GUICtrlCreateButton("6", 240, 168, 43, 41, $WS_GROUP)
    $btn_number7 = GUICtrlCreateButton("7", 48, 240, 43, 41, $WS_GROUP)
    $btn_number8 = GUICtrlCreateButton("8", 144, 240, 43, 41, $WS_GROUP)
    $btn_number9 = GUICtrlCreateButton("9", 240, 240, 43, 41, $WS_GROUP)
    $output_ergebnis = GUICtrlCreateInput("", 16, 16, 353, 21)
    $btn_zeichen_plus = GUICtrlCreateButton("+", 48, 312, 43, 41, $WS_GROUP)
    $btn_number0 = GUICtrlCreateButton("0", 144, 312, 43, 41, $WS_GROUP)
    $btn_zeichen_minus = GUICtrlCreateButton("-", 240, 312, 43, 41, $WS_GROUP)
    $btn_zeichen_durch = GUICtrlCreateButton("/", 328, 96, 43, 41, $WS_GROUP)
    $btn_zeichen_mal = GUICtrlCreateButton("*", 328, 168, 43, 41, $WS_GROUP)
    $btn_zeichen_gleich = GUICtrlCreateButton("=", 328, 240, 43, 41, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    FileDelete("./rechner.txt")

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $btn_number0
    $nummer0 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer0&"0", 16, 56, 353, 21)
    Case $btn_number1
    $nummer1 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer1&"1", 16, 56, 353, 21)
    Case $btn_number2
    $nummer2 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer2&"2", 16, 56, 353, 21)
    Case $btn_number3
    $nummer3 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer3&"3", 16, 56, 353, 21)
    Case $btn_number4
    $nummer4 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer4&"4", 16, 56, 353, 21)
    Case $btn_number5
    $nummer5 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer5&"5", 16, 56, 353, 21)
    Case $btn_number6
    $nummer6 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer6&"6", 16, 56, 353, 21)
    Case $btn_number7
    $nummer7 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer7&"7", 16, 56, 353, 21)
    Case $btn_number8
    $nummer8 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer8&"8", 16, 56, 353, 21)
    Case $btn_number9
    $nummer9 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer9&"9", 16, 56, 353, 21)
    Case $btn_zeichen_plus
    $zeichen_plus = GUICtrlRead($input_aufgabe)
    FileWriteLine("rechner.txt",$zeichen_plus&"+")
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput("", 16, 56, 353, 21)
    Case $btn_zeichen_minus
    $zeichen_minus = GUICtrlRead($input_aufgabe)
    FileWriteLine("rechner.txt",$zeichen_minus&"-")
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput("", 16, 56, 353, 21)
    Case $btn_zeichen_durch
    $zeichen_durch = GUICtrlRead($input_aufgabe)
    FileWriteLine("rechner.txt",$zeichen_plus&"/")
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput("", 16, 56, 353, 21)
    Case $btn_zeichen_mal
    $zeichen_mal = GUICtrlRead($input_aufgabe)
    FileWriteLine("rechner.txt",$zeichen_plus&"*")
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput("", 16, 56, 353, 21)
    Case $btn_zeichen_gleich
    $zeichen_gleich = GUICtrlRead($input_aufgabe)
    FileWriteLine("rechner.txt",$zeichen_gleich)
    $ergebnis = FileRead("rechner.txt")
    $output_ergebnis = GUICtrlDelete($output_ergebnis)
    $output_ergebnis = GUICtrlCreateInput($ergebnis, 16, 16, 353, 21)
    EndSwitch
    WEnd

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


    und wenn ich dann z.B. 1+1 eingebe und er normalerweise 2 ausgeben sollte gibt er 1+1 aus.
    Ja ich weis woran es liegt aber ich würde gerne wissen wie ich es am einfachsten und besten lösen kann.

    Sry falls ich im script zu viel unnötiges geschrieben habe.

    Mfg Rey96

  • kannst du mal bitte erklären? weil ich nicht ganz verstehe wie du das meinst
    bin ja noch neu :D

  • zum Beispiel

    [autoit]

    MsgBox(0,"",Execute("12+15")

    [/autoit]

    DFPWare

    Edit: Das was du aus der InputBox ausliest ist ein String, also eine Zeichenkette(mit Anführungszeichen) diese kann man nicht so einfach ausrechnen, wie z.B

    [autoit]

    $ergebnis = 12+15

    [/autoit]

    Hier sind nämlich 12 und 15 Zahlen und keine Strings

    Ich werd dir gleich mal nen kleines Bsp basteln ;)


  • omg danke =)

  • Hier mal ein einfacher Rechner:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    $Form1 = GUICreate("Form1", 223, 185, 192, 124)
    $_i = GUICtrlCreateInput("", 16, 16, 193, 21)
    $_1 = GUICtrlCreateButton("1", 16, 48, 35, 33, $WS_GROUP)
    $_2 = GUICtrlCreateButton("2", 56, 48, 35, 33, $WS_GROUP)
    $_3 = GUICtrlCreateButton("3", 96, 48, 35, 33, $WS_GROUP)
    $_4 = GUICtrlCreateButton("4", 136, 48, 35, 33, $WS_GROUP)
    $_5 = GUICtrlCreateButton("5", 176, 48, 35, 33, $WS_GROUP)
    $_6 = GUICtrlCreateButton("6", 16, 88, 35, 33, $WS_GROUP)
    $_7 = GUICtrlCreateButton("7", 56, 88, 35, 33, $WS_GROUP)
    $_8 = GUICtrlCreateButton("8", 96, 88, 35, 33, $WS_GROUP)
    $_9 = GUICtrlCreateButton("9", 136, 88, 35, 33, $WS_GROUP)
    $_10 = GUICtrlCreateButton("=", 176, 136, 35, 33, $WS_GROUP)
    $_11 = GUICtrlCreateButton("+", 16, 136, 35, 33, $WS_GROUP)
    $_12 = GUICtrlCreateButton("-", 56, 136, 35, 33, $WS_GROUP)
    $_13 = GUICtrlCreateButton("*", 96, 136, 35, 33, $WS_GROUP)
    $_14 = GUICtrlCreateButton("/", 136, 136, 35, 33, $WS_GROUP)
    GUISetState(@SW_SHOW)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $_1
    $read = GUICtrlRead($_i)
    GUICtrlSetData($_i,$read & "1")
    Case $_2
    $read = GUICtrlRead($_i)
    GUICtrlSetData($_i,$read & "2")
    Case $_3
    $read = GUICtrlRead($_i)
    GUICtrlSetData($_i,$read & "3")
    Case $_4
    $read = GUICtrlRead($_i)
    GUICtrlSetData($_i,$read & "4")
    Case $_5
    $read = GUICtrlRead($_i)
    GUICtrlSetData($_i,$read & "5")
    Case $_6
    $read = GUICtrlRead($_i)
    GUICtrlSetData($_i,$read & "6")
    Case $_7
    $read = GUICtrlRead($_i)
    GUICtrlSetData($_i,$read & "7")
    Case $_8
    $read = GUICtrlRead($_i)
    GUICtrlSetData($_i,$read & "8")
    Case $_9
    $read = GUICtrlRead($_i)
    GUICtrlSetData($_i,$read & "9")
    Case $_10
    $read = GUICtrlRead($_i)
    MsgBox(0,"Ergebnis:",Execute($read))
    Case $_11
    $read = GUICtrlRead($_i)
    GUICtrlSetData($_i,$read & "+")
    Case $_12
    $read = GUICtrlRead($_i)
    GUICtrlSetData($_i,$read & "-")
    Case $_13
    $read = GUICtrlRead($_i)
    GUICtrlSetData($_i,$read & "*")
    Case $_14
    $read = GUICtrlRead($_i)
    GUICtrlSetData($_i,$read & "/")
    Exit
    EndSwitch
    WEnd

    [/autoit]
  • so ich habe jetzt gemacht das er es nicht mehr speichert sondern nurnoch in der leiste lässt und dann sollte er ja mit Execute sie ausrechnen. aber egal was ich eingebe es kommt immer 3 raus

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $main = GUICreate("Rechner by Rey96", 388, 383, 192, 124)
    $input_aufgabe = GUICtrlCreateInput("", 16, 56, 353, 21)
    $btn_number1 = GUICtrlCreateButton("1", 48, 96, 43, 41, $WS_GROUP)
    $btn_number2 = GUICtrlCreateButton("2", 144, 96, 41, 41, $WS_GROUP)
    $btn_number3 = GUICtrlCreateButton("3", 240, 96, 43, 41, $WS_GROUP)
    $btn_number4 = GUICtrlCreateButton("4", 48, 168, 43, 41, $WS_GROUP)
    $btn_number5 = GUICtrlCreateButton("5", 144, 168, 43, 41, $WS_GROUP)
    $btn_number6 = GUICtrlCreateButton("6", 240, 168, 43, 41, $WS_GROUP)
    $btn_number7 = GUICtrlCreateButton("7", 48, 240, 43, 41, $WS_GROUP)
    $btn_number8 = GUICtrlCreateButton("8", 144, 240, 43, 41, $WS_GROUP)
    $btn_number9 = GUICtrlCreateButton("9", 240, 240, 43, 41, $WS_GROUP)
    $output_ergebnis = GUICtrlCreateInput("", 16, 16, 353, 21)
    $btn_zeichen_plus = GUICtrlCreateButton("+", 48, 312, 43, 41, $WS_GROUP)
    $btn_number0 = GUICtrlCreateButton("0", 144, 312, 43, 41, $WS_GROUP)
    $btn_zeichen_minus = GUICtrlCreateButton("-", 240, 312, 43, 41, $WS_GROUP)
    $btn_zeichen_durch = GUICtrlCreateButton("/", 328, 96, 43, 41, $WS_GROUP)
    $btn_zeichen_mal = GUICtrlCreateButton("*", 328, 168, 43, 41, $WS_GROUP)
    $btn_zeichen_gleich = GUICtrlCreateButton("=", 328, 240, 43, 41, $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 $btn_number0
    $nummer0 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer0&"0", 16, 56, 353, 21)
    Case $btn_number1
    $nummer1 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer1&"1", 16, 56, 353, 21)
    Case $btn_number2
    $nummer2 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer2&"2", 16, 56, 353, 21)
    Case $btn_number3
    $nummer3 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer3&"3", 16, 56, 353, 21)
    Case $btn_number4
    $nummer4 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer4&"4", 16, 56, 353, 21)
    Case $btn_number5
    $nummer5 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer5&"5", 16, 56, 353, 21)
    Case $btn_number6
    $nummer6 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer6&"6", 16, 56, 353, 21)
    Case $btn_number7
    $nummer7 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer7&"7", 16, 56, 353, 21)
    Case $btn_number8
    $nummer8 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer8&"8", 16, 56, 353, 21)
    Case $btn_number9
    $nummer9 = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($nummer9&"9", 16, 56, 353, 21)
    Case $btn_zeichen_plus
    $zeichen_plus = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($zeichen_plus&"+", 16, 56, 353, 21)
    Case $btn_zeichen_minus
    $zeichen_minus = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($zeichen_minus&"-", 16, 56, 353, 21)
    Case $btn_zeichen_durch
    $zeichen_durch = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($zeichen_durch&"/", 16, 56, 353, 21)
    Case $btn_zeichen_mal
    $zeichen_mal = GUICtrlRead($input_aufgabe)
    $input_aufgabe = GUICtrlDelete($input_aufgabe)
    $input_aufgabe = GUICtrlCreateInput($zeichen_mal&"*", 16, 56, 353, 21)
    Case $btn_zeichen_gleich
    $ergebnis = GUICtrlRead($input_aufgabe)
    $execute = Execute($input_aufgabe)
    $output_ergebnis = GUICtrlDelete($output_ergebnis)
    $output_ergebnis = GUICtrlCreateInput($execute, 16, 16, 353, 21)
    EndSwitch
    WEnd

    [/autoit]
  • Es muss am Ende so heißen:

    Spoiler anzeigen
    [autoit]

    Case $btn_zeichen_gleich
    $ergebnis = GUICtrlRead($input_aufgabe)
    $execute = Execute($ergebnis)
    $output_ergebnis = GUICtrlDelete($output_ergebnis)
    $output_ergebnis = GUICtrlCreateInput($execute, 16, 16, 353, 21)

    [/autoit]

    Außerdem solltest du

    [autoit]

    $output_ergebnis = GUICtrlDelete($output_ergebnis)
    $output_ergebnis = GUICtrlCreateInput($execute, 16, 16, 353, 21)

    [/autoit]

    durch

    [autoit]

    guictrlsetdata($output_ergebnis,$execute)

    [/autoit]

    ersetzen

    DFPWare

  • so danke ihr beiden aber ich würde gerne noch wissen wie ich mit einem button nur das letzte zeichen z.B. bei 5+4 habe ich ausversehen 5+5 eingegeben und wie mache ich das ich per button dann die letzte 5 weg löschen kann?
    hatte da mal was mit backspace gehört aber keine ahnung wie

    ps: kann mir dann noch wer sagen wie ich ne komma funktion einbaue? :D


    edit: komma habe ich raus =)

  • Wenn man auf die Zahl 5 drückt eine Variable erstellen:

    [autoit]

    $letzeeingabe = "5"

    [/autoit]


    Dann ein Button machen mit
    Case $button
    StringReplace($input/wasauchimmer,$letzteeingabe,"")

  • das habe ich ich meinte so das wenn da so zb. 50+44-80- steht und man ja am ende kein minus will das man das mit einem zurück knopf weg macht :D
    welcher befehl dahin kommt will ich gerne wissen

  • [autoit]

    GUICtrlSetData($CtrlID, StringLeft(GUICtrlRead($CtrlID), StringLen(GUICtrlRead($CtrlID)-1))

    [/autoit]

    wie füg ich das ein?
    brauche ich ein include?

  • Nein, du brauchst kein include. $CtrlID ersetzt du durch die Variable, in der die Control ID des Inputs drin ist und das ganze setzt du halt bei de m Case Zweig von dem Button, der die Funktion haben soll.


  • Nein, du brauchst kein include. $CtrlID ersetzt du durch die Variable, in der die Control ID des Inputs drin ist und das ganze setzt du halt bei de m Case Zweig von dem Button, der die Funktion haben soll.

    [autoit]

    Case $btn_back
    GUICtrlSetData($input_aufgabe), StringLeft(GUICtrlRead($input_aufgabe), StringLen(GUICtrlRead($input_aufgabe)-1))

    [/autoit]


    da kommen immer die errors

    C:\Users\*****\Desktop\Rechner.au3(101,33) : ERROR: GUICtrlSetData() [built-in] called with wrong number of args.
    GUICtrlSetData($input_aufgabe)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\Users\*****\Desktop\Rechner.au3(101,34) : ERROR: syntax error
    GUICtrlSetData($input_aufgabe),
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    C:\Users\*****\Desktop\Rechner.au3 - 2 error(s), 0 warning(s)

    • Offizieller Beitrag

    Bei Deinem Skript kann man viel einsparen, wenn man Arrays und Schleifen verwendet.
    Hier mal ein kleiner Taschenrechner mit Arrays und im OnEventMode:

    Spoiler anzeigen
    [autoit]


    #include <WindowsConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    Opt('GUIOnEventMode', 1)
    Global $aButtons[18] = ['7', '8', '9', '/', '4', '5', '6', '*', '1', '2', '3', '-', '<-', '0', '.', '+', 'C', '=']
    Global $aKeys[18] = [ _
    '{NUMPAD7}', '{NUMPAD8}', '{NUMPAD9}', '{NUMPADDIV}', _
    '{NUMPAD4}', '{NUMPAD5}', '{NUMPAD6}', '{NUMPADMULT}', _
    '{NUMPAD1}', '{NUMPAD2}', '{NUMPAD3}', '{NUMPADSUB}', _
    '{BACKSPACE}', '{NUMPAD0}', '{NUMPADDOT}', '{NUMPADADD}', _
    '{DEL}', '{ENTER}']
    Global $aAccelKeys[18][2], $ahButtons[18]

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

    $hGui = GUICreate('Taschenrechner', 228, 280)
    GUISetOnEvent($GUI_EVENT_CLOSE, '_End')
    GUISetFont(14, 600, 0, 'Verdana')
    $hOutput = GUICtrlCreateLabel('', 16, 10, 196, 28, $SS_RIGHT, $WS_EX_STATICEDGE)
    GUICtrlSetFont(-1, 14, 400)
    GUICtrlSetBkColor(-1, 0xAAFFAA)
    For $i = 0 To 17
    If $i = 17 Then
    $ahButtons[$i] = GUICtrlCreateButton($aButtons[$i], 74, 48 + Int($i / 4) * 48, 80, 32)
    Else
    $ahButtons[$i] = GUICtrlCreateButton($aButtons[$i], 26 + Mod($i, 4) * 48, 48 + Int($i / 4) * 48, 32, 32)
    EndIf
    GUICtrlSetOnEvent(-1, '_Input')
    $aAccelKeys[$i][0] = $aKeys[$i]
    $aAccelKeys[$i][1] = $ahButtons[$i]
    Next
    GUISetAccelerators($aAccelKeys, $hGui)
    GUISetState()

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

    While Sleep(50)
    WEnd

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

    Func _End()
    Exit
    EndFunc ;==>_End

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

    Func _Input()
    Local $iPressed = @GUI_CtrlId - $ahButtons[0]
    GUICtrlSetState(@GUI_CtrlId, $GUI_HIDE)
    Sleep(50)
    GUICtrlSetState(@GUI_CtrlId, $GUI_SHOW)
    Switch $iPressed
    Case 17 ; "=" gedrückt
    GUICtrlSetData($hOutput, Execute(GUICtrlRead($hOutput)))
    Case 16 ; "C" gedrückt
    GUICtrlSetData($hOutput, '')
    Case 12 ; "<-" gedrückt
    GUICtrlSetData($hOutput, StringTrimRight(GUICtrlRead($hOutput), 1))
    Case Else ; restliche Tasten
    GUICtrlSetData($hOutput, GUICtrlRead($hOutput) & $aButtons[$iPressed])
    EndSwitch
    GUICtrlSetState(@GUI_CtrlId, $GUI_FOCUS)
    EndFunc ;==>_Input

    [/autoit]
  • Das Programm namens „TRechner-Demo“ stellt einen sehr einfachen Taschenrechner mit den vier
    Grundrechenarten zur Verfügung. Der Rechner ist vom inneren Aufbau her bewusst einfach gestaltet.
    Er besteht im Wesentlichen aus einem Hauptfenster. Includes werden keine benötigt. TRechner-Demo
    ist weder fertig, noch vollständig, er ist ein erster Anhaltspunkt und soll zu Veränderung,
    Verbesserung und zur Anpassung an Deine Anforderungen dienen !

    Viel Spaß mit TRechner-Demo !

    TRechner-Demo
    [autoit]


    ; TRechner - Demo by RR04
    $GUI = GUICreate("TRechner - Demo", 320, 200)
    $input = GUICtrlCreateInput("", 10, 10, 300, 20)
    $bnPlus = GUICtrlCreateButton("+", 10, 40, 75, 30)
    $bnMinus = GUICtrlCreateButton("-", 85, 40, 75, 30)
    $bnDiv = GUICtrlCreateButton("/", 160, 40, 75, 30)
    $bnMulti = GUICtrlCreateButton("*", 235, 40, 75, 30)
    $bn7 = GUICtrlCreateButton("7", 10, 70, 75, 30)
    $bn8 = GUICtrlCreateButton("8", 85, 70, 75, 30)
    $bn9 = GUICtrlCreateButton("9", 160, 70, 75, 30)
    $bnC = GUICtrlCreateButton("C", 235, 70, 75, 60)
    $bn4 = GUICtrlCreateButton("4", 10, 100, 75, 30)
    $bn5 = GUICtrlCreateButton("5", 85, 100, 75, 30)
    $bn6 = GUICtrlCreateButton("6", 160, 100, 75, 30)
    $bn1 = GUICtrlCreateButton("1", 10, 130, 75, 30)
    $bn2 = GUICtrlCreateButton("2", 85, 130, 75, 30)
    $bn3 = GUICtrlCreateButton("3", 160, 130, 75, 30)
    $bnResultat = GUICtrlCreateButton("=", 235, 130, 75, 60)
    $bn0 = GUICtrlCreateButton("0", 10, 160, 150, 30)
    $bnKoma = GUICtrlCreateButton(".", 160, 160, 75, 30)

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

    GUISetState()

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

    While 1
    Switch GUIGetMsg()
    Case -3
    MsgBox(64, "TRechner - Demo", "Viel Spaß wünscht RR04 !" & @TAB, 3)
    Exit
    Case $bnC
    GUICtrlSetData($input, "")
    Case $bn1
    GUICtrlSetData($input, GUICtrlRead($input) & "1")
    Case $bn2
    GUICtrlSetData($input, GUICtrlRead($input) & "2")
    Case $bn3
    GUICtrlSetData($input, GUICtrlRead($input) & "3")
    Case $bn4
    GUICtrlSetData($input, GUICtrlRead($input) & "4")
    Case $bn5
    GUICtrlSetData($input, GUICtrlRead($input) & "5")
    Case $bn6
    GUICtrlSetData($input, GUICtrlRead($input) & "6")
    Case $bn7
    GUICtrlSetData($input, GUICtrlRead($input) & "7")
    Case $bn8
    GUICtrlSetData($input, GUICtrlRead($input) & "8")
    Case $bn9
    GUICtrlSetData($input, GUICtrlRead($input) & "9")
    Case $bnPlus
    GUICtrlSetData($input, GUICtrlRead($input) & "+")
    Case $bnMinus
    GUICtrlSetData($input, GUICtrlRead($input) & "-")
    Case $bnDiv
    GUICtrlSetData($input, GUICtrlRead($input) & "/")
    Case $bnMulti
    GUICtrlSetData($input, GUICtrlRead($input) & "*")
    Case $bn0
    GUICtrlSetData($input, GUICtrlRead($input) & "0")
    Case $bnKoma
    GUICtrlSetData($input, GUICtrlRead($input) & ".")
    Case $bnResultat
    If GUICtrlRead($input) = "" Then
    MsgBox(64, "Fehler", "Bitte machen Sie erst Ihre Eingaben !" & @TAB)
    Else
    GUICtrlSetData($input, Execute(GUICtrlRead($input)))
    EndIf
    EndSwitch
    WEnd

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

    ; Ende

    [/autoit]
  • hey danke aber ich wollte nur wissen wie die funktion ist per knopfdruck das letzte zeichen aus dem eingabe feld zu entfernen