Hiho nach langem hin und her (auch in der Shouthbox >_<)
Hab ich mich entschloss nun doch n Thread zu machen....
Ich wollte als kleine Array übung n taschenrechner machen...
Das Prinzip funktioniert bisjetze....BISJETZE xD
Ihrwie hab ich atm n totalen Brain Freeze -.- und komm ned weiter...
Hier mal n Paar zeilen Code
Spoiler anzeigen
#Region ### include ###
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <RestrictControlRegExp.au3>
#EndRegion ### include ###
;=============
#Region ### Global Button ###
Global $mButton[16]
Global $Function[17] = ['0','.','=','1','2','3','4','5','6','7','8','9','0','/','*','+','%']
Global $BN1[4] = [' / ',' * ',' + ',' - ']
Global $BN2[3] = ['7','8','9']
Global $BN3[3] = ['4','5','6']
Global $BN4[3] = ['1','2','3']
Global $BN5[3] = ['0','.',' ']
Global $BLines[5] = [16,56,96,136,176]
Global $Height[1] = [27]
Global $Text, $Text1, $Taste1, $Input
#EndRegion ### Global Button ###
#Region ### GUI ###
GUICreate("Rechner", 179, 218, 606, 437)
GUICtrlCreateGroup("", 8, 0, 161, 209)
$Input = GUICtrlCreateInput('',16,16,145,21)
For $i = 0 To 3
$mButton[$i] = GUICtrlCreateButton($BN1[$i],$BLines[$i],48,27,$Height)
Next
For $i = 1 To 3
$Num = ($i * 4)
$mButton[$Num] = GUICtrlCreateButton($BN2[$i-1],$BLines[$i-1],80,27,$Height)
$mButton[$Num+1] = GUICtrlCreateButton($BN3[$i-1],$BLines[$i-1],112,27,$Height)
$mButton[$Num+2] = GUICtrlCreateButton($BN4[$i-1],$BLines[$i-1],144,27,$Height)
$mButton[$Num+3] = GUICtrlCreateButton($BN5[$i-1],$BLines[$i-1],176,27,$Height)
Next
$Rechn = GUICtrlCreateButton('=',136,144,27,55)
$Clean = GUICtrlCreateButton('C',136,80,27,20)
GUISetState(@SW_SHOW)
#EndRegion ### GUI ###
;=============
#Region ### EVENT ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $mButton[0] to $mButton[15]
$Taste = GuictrlRead($nMsg)
$Text&= $Taste
GUICtrlSetData($Input,$Text)
Case $Rechn
_Rechn()
Case $Clean
_Clean()
EndSwitch
WEnd
#EndRegion ### EVENT ###
;=============
#Region ### Func _Rechn() ###
Func _Rechn()
;~ Zur orientierung
;~ $V = GUICtrlRead($Input,1)
;~ $1 = StringRegExp($Text,'[\d]|[\d\d]|[\d\d\d]|[\d\d\d\d\d]')
;~ $2 = StringRegExp($Text,'[\.]')
;~ $3 = StringRegExp($Text,'[\d]|[\d\d]|[\d\d\d]|[\d\d\d\d\d]')
;~ $4 = StringRegExp($Text,'[\ + ]|\ - ]|[\ / ]|[\ * ]')
;~ $5 = StringRegExp($Text,'[\d]|[\d\d]|[\d\d\d]|[\d\d\d\d\d]')
;~ $6 = StringRegExp($Text,'[\.]')
;~ $7 = StringRegExp($Text,'[\d]|[\d\d]|[\d\d\d]|[\d\d\d\d\d]')
;~ $8 = StringRegExp($Text,'[\ = ]')
;~ Fertig mit Orientieren
If StringRegExp($Text,'[\+]')Then
$E = $Text + $Taste
ControlSetText('','',$Input,$E)
EndIf
If StringRegExp($Text,'\-]') Then
$E = $Text - $Taste
ControlSetText('','',$Input,$E)
EndIf
If StringRegExp($Text,'[\/]') Then
$E = $Text / $Taste
ControlSetText('','',$Input,$E)
EndIf
If StringRegExp($Text,'[\*]') Then
$E = $Text * $Taste
ControlSetText('','',$Input,$E)
EndIf
EndFunc
#EndRegion ### Func _Rechn() ###
;=============
#Region ### Func _Clean() ###
Func _Clean()
ControlSetText('','',$Input,'0')
EndFunc
#EndRegion ### Func _Clean() ###
Das funktioniert bisher ganz ok...solange nur eine zahl nach dem operator kommt und da weiss ich ned mehr weiter,wie ich das machenkann das er dan nichtmehr die lezte Zahl nimmt sondern die Ganze zahl die da steht.