Global $Calc[20] = ["1", "2", "3", "+", "4", "5", "6", "-", "7", "8", "9", "X", ".", "0", "=", "÷", "(", ")", "Back", "C"]
GUICreate("calculator",200,205)
$ioput = GUICtrlCreateInput("",10,10,180,20)
$x=10
$y=40
For $i = 0 To 19
$Calc[$i] = GUICtrlCreateButton($Calc[$i],$x,$y,43,30)
If Mod(($i+1), 4)=0 Then
$x=10
$y += 32
Else
$x += 45
EndIf
Next
GUISetState()
$str=""
While 1
Switch GUIGetMsg()
Case -3
Exit
Case $Calc[0]
$str &= "1"
GUICtrlSetData($ioput,$str)
Case $Calc[1]
$str &= "2"
GUICtrlSetData($ioput,$str)
Case $Calc[2]
$str &= "3"
GUICtrlSetData($ioput,$str)
Case $Calc[3]
$str &= "+"
GUICtrlSetData($ioput,$str)
Case $Calc[4]
$str &= "4"
GUICtrlSetData($ioput,$str)
Case $Calc[5]
$str &= "5"
GUICtrlSetData($ioput,$str)
Case $Calc[6]
$str &= "6"
GUICtrlSetData($ioput,$str)
Case $Calc[7]
$str &= "-"
GUICtrlSetData($ioput,$str)
Case $Calc[8]
$str &= "7"
GUICtrlSetData($ioput,$str)
Case $Calc[9]
$str &= "8"
GUICtrlSetData($ioput,$str)
Case $Calc[10]
$str &= "9"
GUICtrlSetData($ioput,$str)
Case $Calc[11]
$str &= "*"
GUICtrlSetData($ioput,$str)
Case $Calc[12]
$str &= "."
GUICtrlSetData($ioput,$str)
Case $Calc[13]
$str &= "0"
GUICtrlSetData($ioput,$str)
Case $Calc[14]
$str = Execute($str)
GUICtrlSetData($ioput,$str)
Case $Calc[15]
$str &= "/"
GUICtrlSetData($ioput,$str)
Case $Calc[16]
$str &= "("
GUICtrlSetData($ioput,$str)
Case $Calc[17]
$str &= ")"
GUICtrlSetData($ioput,$str)
Case $Calc[18]
$str = StringLeft($str, StringLen($str)-1)
GUICtrlSetData($ioput,$str)
Case $Calc[19]
$str = ""
GUICtrlSetData($ioput,$str)
EndSwitch
$str = GUICtrlRead($ioput)
WEnd