Ähm ja da es kommt keine Fehlermeldung. Es geht halt nicht ich kann immernoch unendlich eingeben.
Code: Alles auswählen
EnableExplicit
Enumeration
#Window_0
EndEnumeration
Enumeration
#String_0
#Button_0
#Button_1
#Button_2
#Button_3
#Button_4
#Button_5
#Button_6
#Button_7
#Button_8
#Button_9
#Button_10
#Button_11
#Button_12
#Button_13
#Button_14
#Button_15
#Button_16
#Button_17
#ButtonZahl_0
#ButtonZahl_1
#ButtonZahl_2
#ButtonZahl_3
#ButtonZahl_4
#ButtonZahl_5
#ButtonZahl_6
#ButtonZahl_7
#ButtonZahl_8
#ButtonZahl_9
EndEnumeration
Global FontID1, FontID2, FontID3
FontID1 = LoadFont(1, "Arial", 10, #PB_Font_Bold)
FontID2 = LoadFont(2, "Arial", 14)
FontID3 = LoadFont(3, "Arial", 22)
If OpenWindow(#Window_0, 511, 245, 518, 548, "Rechner", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
AddKeyboardShortcut(0, #PB_Shortcut_Return, 10)
AddKeyboardShortcut(0, #PB_Shortcut_Pad0, 0)
AddKeyboardShortcut(0, #PB_Shortcut_Pad1, 1)
AddKeyboardShortcut(0, #PB_Shortcut_Pad2, 2)
AddKeyboardShortcut(0, #PB_Shortcut_Pad3, 3)
AddKeyboardShortcut(0, #PB_Shortcut_Pad4, 4)
AddKeyboardShortcut(0, #PB_Shortcut_Pad5, 5)
AddKeyboardShortcut(0, #PB_Shortcut_Pad6, 6)
AddKeyboardShortcut(0, #PB_Shortcut_Pad7, 7)
AddKeyboardShortcut(0, #PB_Shortcut_Pad8, 8)
AddKeyboardShortcut(0, #PB_Shortcut_Pad9, 9)
AddKeyboardShortcut(0, #PB_Shortcut_Decimal, 11)
AddKeyboardShortcut(0, #PB_Shortcut_Multiply, 12)
AddKeyboardShortcut(0, #PB_Shortcut_Divide, 13)
AddKeyboardShortcut(0, #PB_Shortcut_Subtract, 14)
AddKeyboardShortcut(0, #PB_Shortcut_Add, 15)
If CreateGadgetList(WindowID(#Window_0))
SetGadgetFont(-1, FontID2)
StringGadget(#String_0, 20, 40, 480, 30, "", #PB_String_ReadOnly)
SendMessage_(GadgetID(#String_0),#EM_LIMITTEXT,5,0)
ButtonGadget(#Button_0, 20, 140, 60, 60, "CE")
ButtonGadget(#Button_1, 100, 140, 60, 60, "/")
ButtonGadget(#Button_2, 180, 140, 60, 60, "X")
ButtonGadget(#ButtonZahl_7, 20, 220, 60, 60, "7")
ButtonGadget(#ButtonZahl_8, 100, 220, 60, 60, "8")
ButtonGadget(#ButtonZahl_9, 180, 220, 60, 60, "9")
ButtonGadget(#ButtonZahl_4, 20, 300, 60, 60, "4")
ButtonGadget(#ButtonZahl_5, 100, 300, 60, 60, "5")
ButtonGadget(#ButtonZahl_6, 180, 300, 60, 60, "6")
ButtonGadget(#Button_9, 260, 140, 60, 60, "-")
ButtonGadget(#Button_10, 260, 220, 60, 140, "+")
ButtonGadget(#Button_11, 260, 380, 60, 140, "OK")
ButtonGadget(#ButtonZahl_3, 180, 380, 60, 60, "3")
ButtonGadget(#ButtonZahl_2, 100, 380, 60, 60, "2")
ButtonGadget(#ButtonZahl_1, 20, 380, 60, 60, "1")
ButtonGadget(#ButtonZahl_0, 20, 460, 140, 60, "0")
ButtonGadget(#Button_16, 180, 460, 60, 60, ",")
ButtonGadget(#Button_17, 390, 460, 110, 60, "EXIT")
EndIf
EndIf
Define Event, WindowID, GadgetID, EventType, MenuID
Define.f a, b, c, d, e, f, g, v, x
Repeat
Event = WaitWindowEvent()
WindowID = EventWindow()
GadgetID = EventGadget()
EventType = EventType()
MenuID = EventMenu()
Select Event
Case #PB_Event_Menu
If EventMenu() = 10 ;Return
Goto ButtonReturn
ElseIf EventMenu() = 11 ;komma
Goto komma
ElseIf EventMenu() = 12 ;x
Goto ma
ElseIf EventMenu() = 13 ;/
Goto du
ElseIf EventMenu() = 15 ;+
Goto pl
ElseIf EventMenu() = 14 ;-
Goto mi
ElseIf EventMenu() => 0 And EventMenu() <= 9
If v=1
StringGadget(#String_0, 20, 40, 480, 30, "", #PB_String_ReadOnly)
SendMessage_(GadgetID(#String_0),#EM_LIMITTEXT,5,0)
v=0
EndIf
StringGadget(#String_0, 20, 40, 480, 30, GetGadgetText(#String_0)+Str(EventMenu()-0), #PB_String_ReadOnly)
SendMessage_(GadgetID(#String_0),#EM_LIMITTEXT,5,0)
EndIf
Case #PB_Event_Gadget
Select GadgetID
;Case #String_0
Case #Button_0 ;CE
StringGadget(#String_0, 20, 40, 480, 30, "", #PB_String_ReadOnly)
SendMessage_(GadgetID(#String_0),#EM_LIMITTEXT,5,0)
Case #ButtonZahl_0 To #ButtonZahl_9
If v=1
StringGadget(#String_0, 20, 40, 480, 30, "", #PB_String_ReadOnly)
SendMessage_(GadgetID(#String_0),#EM_LIMITTEXT,5,0)
v=0
EndIf
StringGadget(#String_0, 20, 40, 480, 30, GetGadgetText(#String_0)+Str(GadgetID-#ButtonZahl_0), #PB_String_ReadOnly)
SendMessage_(GadgetID(#String_0),#EM_LIMITTEXT,5,0)
Case #Button_16; #PB_Key_PadComma
komma:
x =ValF(GetGadgetText(#String_0))
StringGadget(#String_0, 20, 40, 480, 30, Str(x)+".", #PB_String_ReadOnly)
SendMessage_(GadgetID(#String_0),#EM_LIMITTEXT,5,0)
Case #Button_17
End
Case #Button_1 ;/
du:
v=0
a=1
b=0
c=0
d=0
SetGadgetText(0, ReplaceString(GetGadgetText(0),",","."))
f=ValF(GetGadgetText(#String_0))
StringGadget(#String_0, 20, 40, 480, 30, "", #PB_String_ReadOnly)
SendMessage_(GadgetID(#String_0),#EM_LIMITTEXT,5,0)
Case #Button_2 ;x
ma:
v=0
a=0
b=1
c=0
d=0
SetGadgetText(0, ReplaceString(GetGadgetText(0),",","."))
f=ValF(GetGadgetText(#String_0))
StringGadget(#String_0, 20, 40, 480, 30, "", #PB_String_ReadOnly)
SendMessage_(GadgetID(#String_0),#EM_LIMITTEXT,5,0)
Case #Button_9 ;-
mi:
v=0
a=0
b=0
c=1
d=0
SetGadgetText(0, ReplaceString(GetGadgetText(0),",","."))
f=ValF(GetGadgetText(#String_0))
StringGadget(#String_0, 20, 40, 480, 30, "", #PB_String_ReadOnly)
SendMessage_(GadgetID(#String_0),#EM_LIMITTEXT,5,0)
Case #Button_10 ;+
pl:
v=0
a=0
b=0
c=0
d=1
SetGadgetText(0, ReplaceString(GetGadgetText(0),",","."))
f=ValF(GetGadgetText(#String_0))
StringGadget(#String_0, 20, 40, 480, 30, "", #PB_String_ReadOnly)
SendMessage_(GadgetID(#String_0),#EM_LIMITTEXT,5,0)
Case #Button_11 ;ok
ButtonReturn:
SetGadgetText(0, ReplaceString(GetGadgetText(0),",","."))
g=ValF(GetGadgetText(#String_0))
v=1
If c=1
e=f -g
StringGadget(#String_0, 20, 40, 480, 30, StrF(e ,2), #PB_String_ReadOnly)
SendMessage_(GadgetID(#String_0),#EM_LIMITTEXT,5,0)
EndIf
If a=1
e=f/g
StringGadget(#String_0, 20, 40, 480, 30, StrF(e ,2), #PB_String_ReadOnly)
SendMessage_(GadgetID(#String_0),#EM_LIMITTEXT,5,0)
EndIf
If b=1
e=f *g
StringGadget(#String_0, 20, 40, 480, 30, StrF(e ,2), #PB_String_ReadOnly)
SendMessage_(GadgetID(#String_0),#EM_LIMITTEXT,5,0)
EndIf
If d=1
e=f+g
StringGadget(#String_0, 20, 40, 480, 30, StrF(e ,2), #PB_String_ReadOnly)
SendMessage_(GadgetID(#String_0),#EM_LIMITTEXT,5,0)
EndIf
EndSelect
EndSelect
Until Event= #PB_Event_CloseWindow
End