Re: Ergebnis anzeigen?
Verfasst: 27.02.2010 01:08
Hoppla,
da fehlt doch was
Gruß
Kallewirsch
da fehlt doch was
Code: Alles auswählen
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Button_0
#Button_Close
#String_0
#String_1
#String_2
#String_3
#String_4
#STRING_5
#TString_0
#TString_1
#TString_2
#TString_3
#TString_4
#TString_5
#TString_6
#TString_7
#TString_8
#STRING_INPUT
#STRING_INPUT_1
EndEnumeration
#CRLF$ = Chr(10)+Chr(13)
SetControl=0
LoadFont(0, "Arial", 36)
LoadFont(1, "Arial", 24)
Procedure Open_Window_0()
If OpenWindow(#Window_0, 248, 16, 730, 642, "Kallewirsch Mittelwertrechner", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
SetWindowColor(#Window_0,$FBE6C5)
TextGadget(#TString_0, 300, 50, 450, 250, "Danke für " + #CRLF$ + "die Hilfe! " + #CRLF$ + "So ist der Rechner super!!!")
SetGadgetColor(#TString_0, #PB_Gadget_BackColor,$FBE6C5)
SetGadgetFont(#TString_0, FontID(0))
ButtonGadget(#Button_0, 250, 500, 150, 50, "Berechnen")
ButtonGadget(#Button_Close, 450, 500, 150, 50, "Close")
TextGadget(#TString_1, 40, 30, 160, 20, "Zahl 1 eingeben")
SetGadgetColor(#TString_1, #PB_Gadget_BackColor,$FBE6C5)
StringGadget(#String_0, 40, 50, 160, 60, "", #PB_String_Numeric)
SetGadgetFont(#String_0, FontID(0))
TextGadget(#TString_2, 40, 120, 160, 20, "Zahl 2 eingeben")
SetGadgetColor(#TString_2, #PB_Gadget_BackColor,$FBE6C5)
StringGadget(#String_1, 40, 140, 160, 60, "", #PB_String_Numeric)
SetGadgetFont(#String_1, FontID(0))
TextGadget(#TString_3, 40, 210, 160, 20, "Zahl 3 eingeben")
SetGadgetColor(#TString_3, #PB_Gadget_BackColor,$FBE6C5)
StringGadget(#String_2, 40, 230, 160, 60, "", #PB_String_Numeric)
SetGadgetFont(#String_2, FontID(0))
TextGadget(#TString_4, 40, 300, 160, 20, "Zahl 4 eingeben")
SetGadgetColor(#TString_4, #PB_Gadget_BackColor,$FBE6C5)
StringGadget(#String_3, 40, 320, 160, 60, "", #PB_String_Numeric)
SetGadgetFont(#String_3, FontID(0))
TextGadget(#TString_6, 40, 390, 160, 20, "Zahl 5 eingeben")
SetGadgetColor(#TString_6, #PB_Gadget_BackColor,$FBE6C5)
StringGadget(#String_4, 40, 410, 160, 60, "", #PB_String_Numeric)
SetGadgetFont(#String_4, FontID(0))
TextGadget(#TString_7, 40, 480, 160, 20, "Zahl 6 eingeben")
SetGadgetColor(#TString_7, #PB_Gadget_BackColor,$FBE6C5)
StringGadget(#String_5, 40, 500, 160, 60, "", #PB_String_Numeric)
SetGadgetFont(#String_5, FontID(0))
TextGadget(#TString_5, 250, 300, 280, 20, "Mittelwert der Eingaben")
SetGadgetColor(#TString_5, #PB_Gadget_BackColor,$FBE6C5)
StringGadget(#STRING_INPUT, 250, 320, 450, 50,"", #PB_String_Numeric)
SetGadgetFont(#STRING_INPUT, FontID(1))
TextGadget(#TString_8, 250, 380, 280, 20, "Mittelwert x100")
SetGadgetColor(#TString_8, #PB_Gadget_BackColor,$FBE6C5)
StringGadget(#STRING_INPUT_1, 250, 400, 450, 50,"", #PB_String_Numeric)
EndIf
Repeat
iEvent.i = WaitWindowEvent()
Select iEvent
Case #PB_Event_Gadget
Select EventGadget()
Case #Button_0
SetControl=0
; Nur Mittelwert von 1 und 2 wird berechnet
eingabe1$=GetGadgetText(#String_0)
eingabe2$=GetGadgetText(#String_1)
eingabe3$=GetGadgetText(#String_2)
eingabe4$=GetGadgetText(#String_3)
eingabe5$=GetGadgetText(#String_4)
eingabe6$=GetGadgetText(#STRING_5)
If (eingabe1$<>"")
Teiler + 1
Mittelwert = ValD(eingabe1$)
Else
If SetControl=0
MessageRequester("Eingabefehler","Feld 1 muß ausgefüllt werden!")
SetControl=1
EndIf
EndIf
If (eingabe2$<>"")
Teiler + 1
Mittelwert + ValD(eingabe2$)
Else
If SetControl=0
MessageRequester("Eingabefehler","Feld 2 muß ausgefüllt werden!")
SetControl=1
EndIf
EndIf
If (eingabe3$<>"")
Teiler + 1
Mittelwert + ValD(eingabe3$)
Else
If SetControl=0
MessageRequester("Eingabefehler","Feld 3 muß ausgefüllt werden!")
SetControl=1
EndIf
EndIf
If (eingabe4$<>"")
Teiler + 1
Mittelwert + ValD(eingabe4$)
Else
If SetControl=0
MessageRequester("Eingabefehler","Feld 4 muß ausgefüllt werden!")
SetControl=1
EndIf
EndIf
If (eingabe5$<>"")
Teiler + 1
Mittelwert + ValD(eingabe5$)
Else
If SetControl=0
MessageRequester("Eingabefehler","Feld 5 muß ausgefüllt werden!")
SetControl=1
EndIf
EndIf
If (eingabe6$<>"")
Teiler + 1
Mittelwert + ValD(eingabe6$)
Else
If SetControl=0
MessageRequester("Eingabefehler","Feld 6 muß ausgefüllt werden!")
SetControl=1
EndIf
EndIf
If Teiler=6
SetGadgetText(#STRING_INPUT,StrD(Mittelwert/Teiler))
a1.d = Mittelwert / Teiler * 100
Mittel100 = Round(a1, #PB_Round_Up)
SetGadgetText(#STRING_INPUT_1,Str(Mittel100))
SetGadgetColor(#STRING_INPUT_1, #PB_Gadget_BackColor,$00FFFF)
Else
MessageRequester("Fehler","Es müssen alle Felder ausgefüllt werden!")
EndIf
Teiler=0
Case #STRING_INPUT
SetGadgetColor(#STRING_INPUT, #PB_Gadget_BackColor,$00FFFF)
Case #BUTTON_CLOSE
Quit = #True
EndSelect
EndSelect
Until iEvent = #PB_Event_CloseWindow Or Quit = #True
EndProcedure
Open_Window_0()
Kallewirsch