Hinteres Zeichen aus Label entfernen

  • Hier, zwar nicht schön aber pragmatisch:

    Spoiler anzeigen
    [autoit]


    #region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_Res_Fileversion=1.1.0.0
    #AutoIt3Wrapper_Res_Language=1031
    #AutoIt3Wrapper_Run_Tidy=y
    #AutoIt3Wrapper_Run_Obfuscator=y
    #Obfuscator_Parameters=/striponly
    #endregion ;**** Directives created by AutoIt3Wrapper_GUI ****

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

    #region ### START Koda GUI section ###
    GUICreate("Rechner v1.1.0", 346, 313, 205, 145)
    GUICtrlCreateGroup("", 8, 8, 329, 41)
    $Label1 = GUICtrlCreateLabel("", 16, 23, 307, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Input1 = GUICtrlCreateInput("", 8, 56, 329, 21)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    GUICtrlSetState(-1, 128)
    $Button1 = GUICtrlCreateButton("0", 8, 256, 107, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button2 = GUICtrlCreateButton("1", 8, 216, 51, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button3 = GUICtrlCreateButton("2", 64, 216, 51, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button4 = GUICtrlCreateButton("3", 120, 216, 51, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button5 = GUICtrlCreateButton("4", 8, 176, 51, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button6 = GUICtrlCreateButton("5", 64, 176, 51, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button7 = GUICtrlCreateButton("6", 120, 176, 51, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button8 = GUICtrlCreateButton("7", 8, 136, 51, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button9 = GUICtrlCreateButton("8", 64, 136, 51, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button10 = GUICtrlCreateButton("9", 120, 136, 51, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button11 = GUICtrlCreateButton("/", 184, 96, 75, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button12 = GUICtrlCreateButton("*", 184, 136, 75, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button13 = GUICtrlCreateButton("-", 184, 176, 75, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button14 = GUICtrlCreateButton("+", 184, 216, 75, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button15 = GUICtrlCreateButton("=", 184, 256, 75, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button16 = GUICtrlCreateButton("C", 8, 96, 51, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button17 = GUICtrlCreateButton(",", 120, 256, 51, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button18 = GUICtrlCreateButton("^", 120, 96, 51, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button19 = GUICtrlCreateButton("+/-", 64, 96, 51, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button20 = GUICtrlCreateButton("(", 264, 96, 75, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button21 = GUICtrlCreateButton(")", 264, 136, 75, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button22 = GUICtrlCreateButton("Wurzel", 264, 176, 75, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Button23 = GUICtrlCreateButton("<-", 264, 216, 75, 33)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("©", 8, 292, 12, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $Label3 = GUICtrlCreateLabel("Philipp Lehnhausen", 19, 293, 97, 17)
    $zahl1 = "0"
    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case -3
    ExitLoop
    Case $Button16
    $zahl1 = ""
    GUICtrlSetData($Label1, "")
    GUICtrlSetData($Input1, "")
    Case $Button2
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "1")
    Case $Button3
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "2")
    Case $Button4
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "3")
    Case $Button5
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "4")
    Case $Button6
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "5")
    Case $Button7
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "6")
    Case $Button8
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "7")
    Case $Button9
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "8")
    Case $Button10
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "9")
    Case $Button1
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "0")
    Case $Button17
    If Not GUICtrlRead($Label1) = "" Then GUICtrlSetData($Label1, GUICtrlRead($Label1) & ".")
    Case $Button14
    addieren()
    Case $Button13
    subtrahieren()
    Case $Button12
    multiplizieren()
    Case $Button11
    dividieren()
    Case $Button18
    hoch()
    Case $Button20
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "(")
    Case $Button21
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & ")")
    Case $Button19
    $zahl1 = GUICtrlRead($Label1) * (-1)
    GUICtrlSetData($Label1, $zahl1)
    GUICtrlSetData($Input1, $zahl1)
    Case $Button22
    $zahl1 = Sqrt(GUICtrlRead($Label1))
    GUICtrlSetData($Label1, $zahl1)
    GUICtrlSetData($Input1, $zahl1)
    Case $Button23
    backspace()
    Case $Button15
    gleich()
    EndSwitch

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

    If WinActive("Rechner v1.1.0") Then
    HotKeySet("{/}", "dividieren")
    HotKeySet("{*}", "multiplizieren")
    HotKeySet("{+}", "addieren")
    HotKeySet("{-}", "subtrahieren")
    HotKeySet("{ENTER}", "gleich")
    HotKeySet("{NUMPAD1}", "nummer1")
    HotKeySet("{NUMPAD2}", "nummer2")
    HotKeySet("{NUMPAD3}", "nummer3")
    HotKeySet("{NUMPAD4}", "nummer4")
    HotKeySet("{NUMPAD5}", "nummer5")
    HotKeySet("{NUMPAD6}", "nummer6")
    HotKeySet("{NUMPAD7}", "nummer7")
    HotKeySet("{NUMPAD8}", "nummer8")
    HotKeySet("{NUMPAD9}", "nummer9")
    HotKeySet("{NUMPAD0}", "nummer0")
    HotKeySet("{NUMPADMULT}", "multiplizieren")
    HotKeySet("{NUMPADADD}", "addieren")
    HotKeySet("{NUMPADSUB}", "subtrahieren")
    HotKeySet("{NUMPADDIV}", "dividieren")
    HotKeySet("{NUMPADENTER}", "gleich")
    HotKeySet("{^}", "hoch")
    HotKeySet("{BACKSPACE}", "backspace")
    Else
    HotKeySet("{/}")
    HotKeySet("{*}")
    HotKeySet("{+}")
    HotKeySet("{-}")
    HotKeySet("{ENTER}")
    HotKeySet("{NUMPAD1}")
    HotKeySet("{NUMPAD2}")
    HotKeySet("{NUMPAD3}")
    HotKeySet("{NUMPAD4}")
    HotKeySet("{NUMPAD5}")
    HotKeySet("{NUMPAD6}")
    HotKeySet("{NUMPAD7}")
    HotKeySet("{NUMPAD8}")
    HotKeySet("{NUMPAD9}")
    HotKeySet("{NUMPAD0}")
    HotKeySet("{NUMPADMULT}")
    HotKeySet("{NUMPADADD}")
    HotKeySet("{NUMPADSUB}")
    HotKeySet("{NUMPADDIV}")
    HotKeySet("{NUMPADENTER}")
    HotKeySet("{^}")
    HotKeySet("{BACKSPACE}")
    EndIf
    WEnd

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

    Func nummer1()
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "1")
    EndFunc ;==>nummer1

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

    Func nummer2()
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "2")
    EndFunc ;==>nummer2

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

    Func nummer3()
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "3")
    EndFunc ;==>nummer3

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

    Func nummer4()
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "4")
    EndFunc ;==>nummer4

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

    Func nummer5()
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "5")
    EndFunc ;==>nummer5

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

    Func nummer6()
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "6")
    EndFunc ;==>nummer6

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

    Func nummer7()
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "7")
    EndFunc ;==>nummer7

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

    Func nummer8()
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "8")
    EndFunc ;==>nummer8

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

    Func nummer9()
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "9")
    EndFunc ;==>nummer9

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

    Func nummer0()
    GUICtrlSetData($Label1, GUICtrlRead($Label1) & "0")
    EndFunc ;==>nummer0

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

    Func addieren()
    If Not GUICtrlRead($Label1) = "" Then GUICtrlSetData($Label1, GUICtrlRead($Label1) & " + ")
    EndFunc ;==>addieren

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

    Func subtrahieren()
    If Not GUICtrlRead($Label1) = "" Then GUICtrlSetData($Label1, GUICtrlRead($Label1) & " - ")
    EndFunc ;==>subtrahieren

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

    Func dividieren()
    If Not GUICtrlRead($Label1) = "" Then GUICtrlSetData($Label1, GUICtrlRead($Label1) & " / ")
    EndFunc ;==>dividieren

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

    Func multiplizieren()
    If Not GUICtrlRead($Label1) = "" Then GUICtrlSetData($Label1, GUICtrlRead($Label1) & " * ")
    EndFunc ;==>multiplizieren

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

    Func hoch()
    If Not GUICtrlRead($Label1) = "" Then GUICtrlSetData($Label1, GUICtrlRead($Label1) & " ^ ")
    EndFunc ;==>hoch

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

    Func backspace()
    If Not $Label1 = "" Then
    Local $str = StringTrimRight(GUICtrlRead($Label1), 1)
    GUICtrlSetData($Label1, $str)
    EndIf
    EndFunc ;==>backspace

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

    Func gleich()
    Local $result = Execute(GUICtrlRead($Label1))
    GUICtrlSetData($Label1, $result)
    GUICtrlSetData($Input1, $result)
    EndFunc ;==>gleich

    [/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.