Nabend
Will ja jetz endlich mal bissl was mit arrays machen.
So hab ich schnell en kleines beispiel-prog gemacht.
En Rechner, den eigl. jeder in 5 Minuten hin bekommen sollte.
So, jetz is der Code 71 Zeilen lang.
Eigl. viel zu viel für so was einfaches.
Wie also, könnte ich diesen Code nun mit Array kürzen?
( Kleine erklärung wäre super )
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#Region ### START Koda GUI section ###
$Form1_1 = GUICreate("Rechner", 184, 186, 554, 408)
$Input6 = GUICtrlCreateInput("", 16, 16, 110, 20, BitOR($ES_CENTER,$ES_AUTOHSCROLL, $ES_NUMBER))
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Button1 = GUICtrlCreateButton("1", 16, 48, 25, 25, 0)
$Button2 = GUICtrlCreateButton("2", 48, 48, 25, 25, 0)
$Button3 = GUICtrlCreateButton("3", 80, 48, 25, 25, 0)
$Button4 = GUICtrlCreateButton("4", 16, 80, 25, 25, 0)
$Button5 = GUICtrlCreateButton("5", 48, 80, 25, 25, 0)
$Button6 = GUICtrlCreateButton("6", 80, 80, 25, 25, 0)
$Button7 = GUICtrlCreateButton("7", 16, 112, 25, 25, 0)
$Button8 = GUICtrlCreateButton("8", 48, 112, 25, 25, 0)
$Button9 = GUICtrlCreateButton("9", 80, 112, 25, 25, 0)
$Button10 = GUICtrlCreateButton("0", 48, 144, 25, 25, 0)
$Button11 = GUICtrlCreateButton(".", 16, 144, 25, 25, 0)
$Button12 = GUICtrlCreateButton("+", 120, 48, 41, 25, 0)
$Button13 = GUICtrlCreateButton("-", 120, 80, 41, 25, 0)
$Button14 = GUICtrlCreateButton("*", 120, 112, 41, 25, 0)
$Button15 = GUICtrlCreateButton("/", 120, 144, 41, 25, 0)
$Button16 = GUICtrlCreateButton("=", 80, 144, 25, 25, 0)
$Button17 = GUICtrlCreateButton("Clear", 128, 16, 33, 20)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
ControlCommand ($Form1_1, "", $Input6, "EditPaste", "1")
Case $Button2
ControlCommand ($Form1_1, "", $Input6, "EditPaste", "2")
Case $Button3
ControlCommand ($Form1_1, "", $Input6, "EditPaste", "3")
Case $Button4
ControlCommand ($Form1_1, "", $Input6, "EditPaste", "4")
Case $Button5
ControlCommand ($Form1_1, "", $Input6, "EditPaste", "5")
Case $Button6
ControlCommand ($Form1_1, "", $Input6, "EditPaste", "6")
Case $Button7
ControlCommand ($Form1_1, "", $Input6, "EditPaste", "7")
Case $Button8
ControlCommand ($Form1_1, "", $Input6, "EditPaste", "8")
Case $Button9
ControlCommand ($Form1_1, "", $Input6, "EditPaste", "9")
Case $Button10
ControlCommand ($Form1_1, "", $Input6, "EditPaste", "0")
Case $Button11
ControlCommand ($Form1_1, "", $Input6, "EditPaste", ".")
Case $Button12
ControlCommand ($Form1_1, "", $Input6, "EditPaste", "+")
Case $Button13
ControlCommand ($Form1_1, "", $Input6, "EditPaste", "-")
Case $Button14
ControlCommand ($Form1_1, "", $Input6, "EditPaste", "*")
Case $Button15
ControlCommand ($Form1_1, "", $Input6, "EditPaste", "/")
Case $Button16
$Input6Read = GUICtrlRead ($Input6)
$Execute = Execute ($Input6Read)
GUICtrlSetData ($Input6, $Execute)
Case $Button17
GUICtrlSetData ($Input6, "")
EndSwitch
WEnd
Thx schonmal
MfG