Enumeration #HAUPT #BUTTON_SAVE #BUTTON_AUSGABE #BUTTON_PRINT #BUTTON_EXIT EndEnumeration ;####################################################### ;Variablen ----------------------------------------------------------------------------------------------------------- Global Dim h(5,4) Global Dim g(5,4) Global Dim r(5,3) Global Dim ch(5,4) Global Dim cg(5,4) Global Dim cr(5,3) Global gast , heim , spieltag,dirsel.s , quit ;Variablen Ende------------------------------------------------------------------------------------------------------ ;####################################################### ;Prozeduren ---------------------------------------------------------------------------------------------------------- Procedure windowresize() Breite = WindowWidth(#HAUPT) Hoehe = WindowHeight(#HAUPT) a = (Hoehe - 700)/2 ResizeGadget(411,Breite - 310 - (Breite -920)/2, 113+a, #PB_Ignore, #PB_Ignore) ResizeGadget(412,Breite - 210 - (Breite -920)/2, 73+a, #PB_Ignore, #PB_Ignore) ResizeGadget(spieltag,Breite-210 - (Breite -920)/2,110+a, #PB_Ignore, #PB_Ignore) ResizeGadget(413,Breite/2 - 450,0200+a, #PB_Ignore, #PB_Ignore) ResizeGadget(414,Breite/2 + 50,0200+a, #PB_Ignore, #PB_Ignore) ResizeGadget(heim,Breite/2 - 450,240+a, #PB_Ignore, #PB_Ignore) ResizeGadget(gast,Breite/2 + 50,240+a, #PB_Ignore, #PB_Ignore) ResizeGadget(#BUTTON_SAVE,Breite/2 - 305,560+a, #PB_Ignore, #PB_Ignore) ResizeGadget(#BUTTON_AUSGABE,Breite/2 - 100,560+a, #PB_Ignore, #PB_Ignore) ResizeGadget(#BUTTON_PRINT,Breite/2 +105,560+a, #PB_Ignore, #PB_Ignore) ResizeGadget(#BUTTON_EXIT,(Breite - 105),(Hoehe -50), #PB_Ignore, #PB_Ignore) ResizeGadget(415, Breite/2 - 202,280+a, #PB_Ignore, #PB_Ignore) ResizeGadget(416, Breite/2 - 152,280+a, #PB_Ignore, #PB_Ignore) ResizeGadget(417, Breite/2 + 158,280+a, #PB_Ignore, #PB_Ignore) ResizeGadget(418, Breite/2 + 108,280+a, #PB_Ignore, #PB_Ignore) ResizeGadget(419, Breite/2 - 102,283+a, #PB_Ignore, #PB_Ignore) ResizeGadget(420, Breite/2 + 48,283+a, #PB_Ignore, #PB_Ignore) ResizeGadget(421, Breite/2 - 20,283+a, #PB_Ignore, #PB_Ignore) For loop = 0 To 5 ResizeGadget(h(loop,1), Breite/2 - 450,(310 + (loop * 40))+a, #PB_Ignore, #PB_Ignore) ResizeGadget(g(loop,1), Breite/2 + 208,(310 + (loop * 40))+a, #PB_Ignore, #PB_Ignore) ResizeGadget(h(loop,2), Breite/2 - 202,(310 + (loop * 40))+a, #PB_Ignore, #PB_Ignore) ResizeGadget(g(loop,2), Breite/2 + 158,(310 + (loop * 40))+a, #PB_Ignore, #PB_Ignore) ResizeGadget(h(loop,3), Breite/2 - 152,(310 + (loop * 40))+a, #PB_Ignore, #PB_Ignore) ResizeGadget(g(loop,3), Breite/2 + 108,(310 + (loop * 40))+a, #PB_Ignore, #PB_Ignore) If loop > 0 ResizeGadget(h(loop,4), Breite/2 - 102,(310 + (loop * 40))+a, #PB_Ignore, #PB_Ignore) ResizeGadget(g(loop,4), Breite/2 + 48,(310 + (loop * 40))+a, #PB_Ignore, #PB_Ignore) EndIf ResizeGadget(r(loop,1), Breite/2 - 43,(310 + (loop * 40))+a, #PB_Ignore, #PB_Ignore) ResizeGadget(r(loop,2), Breite/2 - 23,(310 + (loop * 40))+a, #PB_Ignore, #PB_Ignore) ResizeGadget(r(loop,3), Breite/2 + 28,(310 + (loop * 40))+a, #PB_Ignore, #PB_Ignore) Next EndProcedure Procedure Quit() ; Ergebnis = MessageRequester("Beenden", "Alle Eingaben gehen verloren. Wirklich beenden?", #PB_MessageRequester_YesNo| #MB_ICONWARNING) ; If Ergebnis = #PB_MessageRequester_Yes Quit = 1 ; EndIf EndProcedure ;Prozeduren ENDE-------------------------------------------------------------------------------------------------- ;####################################################### If LoadFont(1, "Comic Sans MS", 14) And LoadFont(2, "Comic Sans MS", 12) And LoadFont(3, "Comic Sans MS", 20,#PB_Font_Underline|#PB_Font_Bold) And LoadFont(4, "Comic Sans MS", 10) SetGadgetFont(#PB_Default, FontID(1)) EndIf ; Bildschirmauflösung testen If GetSystemMetrics_(#SM_CXSCREEN)=>1024 And GetSystemMetrics_(#SM_CYSCREEN)=>720 ;Hauptfenster erzeugen If OpenWindow(#HAUPT, 0, 0, 1000, 700, "Punktspiel", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget| #PB_Window_MaximizeGadget | #PB_Window_SizeGadget| #PB_Window_Maximize ) WindowBounds(#HAUPT, 920, 620, #PB_Ignore, #PB_Ignore) Breite = WindowWidth(#HAUPT) Hoehe = WindowHeight(#HAUPT) ;##################################################### ; Menu ZEICHNEN ---------------------------------------------------------------------------- ;##################################################### If CreateImageMenu (0, WindowID (#HAUPT) , #PB_Menu_ModernLook) MenuTitle (" Menu ") OpenSubMenu(" Einstellungen") MenuItem(1, "Mannschaften") MenuItem(2, "Mitglieder") ;MenuItem(3, "Speicherort") CloseSubMenu() MenuBar() MenuItem (3, " Hilfe") MenuItem (4, " Über") MenuBar() MenuItem (5, " Beenden") EndIf ; HAUPTINTERFACE ZEICHNEN ---------------------------------------------------------------------------- ;##################################################### SetWindowColor(#HAUPT, #White) TextGadget(410, Breite - 400, 73, 100, 30, "Datum:") SetGadgetColor(410, #PB_Gadget_BackColor, #White) TextGadget(411, Breite - 400, 113, 100, 30, "Liga:") SetGadgetColor(411, #PB_Gadget_BackColor, #White) TextGadget(412, Breite - 300, 73, 200, 30, FormatDate("%dd.%mm.%yyyy", Date())) SetGadgetColor(412, #PB_Gadget_BackColor, #White) spieltag = StringGadget(#PB_Any,Breite-300,110,200,30, "") TextGadget(413, Breite/2 - 450,0200,500,0030, "Heimmannschaft") TextGadget(414, Breite/2 + 050,0200,400,0030, "Gastmannschaft", #PB_Text_Right) SetGadgetColor(413, #PB_Gadget_BackColor, #White) SetGadgetColor(414, #PB_Gadget_BackColor, #White) ButtonGadget(#BUTTON_SAVE,Breite/2 - 305,560,200,40,"Speichern") ButtonGadget(#BUTTON_AUSGABE,Breite/2 - 100,560,200,40,"Ausgabefenster an") ButtonGadget(#BUTTON_PRINT,Breite/2 +105,560,200,40,"Drucken") ButtonGadget(#BUTTON_EXIT,(Breite - 105),(Hoehe.i -30),100,25,"Beenden") heim = ComboBoxGadget(#PB_Any,Breite/2 - 450,0240,400,0030 ) SetGadgetFont(heim, FontID(2)) gast = StringGadget(#PB_Any, Breite/2 + 050,0240,400,0030, "", #PB_Text_Right) #DATEI_REPORT = 1 If ReadFile(#DATEI_REPORT, "Mannschaften.txt") While Eof(#DATEI_REPORT) = #False AddGadgetItem(heim, -1, ReadString(#DATEI_REPORT)) Wend CloseFile(#DATEI_REPORT) EndIf TextGadget(415, Breite/2 - 202,280,045,0030, "HZ", #PB_Text_Center) SetGadgetColor(415, #PB_Gadget_BackColor, #White) TextGadget(416, Breite/2 - 152,280,045,0030, "EZ", #PB_Text_Center) SetGadgetColor(416, #PB_Gadget_BackColor, #White) TextGadget(417, Breite/2 + 158,280,045,0030, "HZ", #PB_Text_Center) SetGadgetColor(417, #PB_Gadget_BackColor, #White) TextGadget(418, Breite/2 + 108,280,045,0030, "EZ", #PB_Text_Center) SetGadgetColor(418, #PB_Gadget_BackColor, #White) SetGadgetFont(#PB_Default, FontID(2)) TextGadget(419, Breite/2 - 102,283,055,0025, "Summe", #PB_Text_Center) SetGadgetColor(419, #PB_Gadget_BackColor, #White) TextGadget(420, Breite/2 + 48,283,055,0025, "Summe", #PB_Text_Center) SetGadgetColor(420, #PB_Gadget_BackColor, #White) TextGadget(421, Breite/2 - 20,283,040,0025, "Dif", #PB_Text_Center) SetGadgetColor(421, #PB_Gadget_BackColor, #White) SetGadgetFont(#PB_Default, FontID(1)) For loop=0 To 5 ; Name h(loop,1)=ComboBoxGadget(#PB_Any,(Breite/2 - 450),(310 + (loop * 40)),0242,030 ) SetGadgetFont(h(loop,1), FontID(2)) g(loop,1)=StringGadget(#PB_Any, breite/2 + 208,(310 + (loop * 40)),0242,0030, "", #PB_Text_Right) ; HZ h(loop,2)=StringGadget(#PB_Any, breite/2 - 202,(310 + (loop * 40)),045,0030, "",#PB_Text_Center|#PB_String_Numeric) g(loop,2)=StringGadget(#PB_Any, breite/2 + 158,(310 + (loop * 40)),045,0030, "",#PB_Text_Center|#PB_String_Numeric) SendMessage_(GadgetID(h(loop,2)),#EM_LIMITTEXT,3,0) SendMessage_(GadgetID(g(loop,2)),#EM_LIMITTEXT,3,0) ; EZ h(loop,3)=StringGadget(#PB_Any, breite/2 - 152,(310 + (loop * 40)),045,0030, "",#PB_Text_Center|#PB_String_Numeric) g(loop,3)=StringGadget(#PB_Any, breite/2 + 108,(310 + (loop * 40)),045,0030, "",#PB_Text_Center|#PB_String_Numeric) SendMessage_(GadgetID(h(loop,3)),#EM_LIMITTEXT,3,0) SendMessage_(GadgetID(g(loop,3)),#EM_LIMITTEXT,3,0) ; Erg If loop > 0 h(loop,4)=StringGadget(#PB_Any, breite/2 - 102,(310 + (loop * 40)),055,0030, "",#PB_Text_Center|#PB_String_ReadOnly|#PB_String_BorderLess) g(loop,4)=StringGadget(#PB_Any, breite/2 + 48,(310 + (loop * 40)),055,0030, "",#PB_Text_Center|#PB_String_ReadOnly|#PB_String_BorderLess) EndIf ; Dif r(loop,1)=StringGadget(#PB_Any, breite/2 - 43,(310 + (loop * 40)),015,0030, "",#PB_String_BorderLess|#PB_String_ReadOnly|#PB_Text_Center) SetGadgetColor(r(loop,1), #PB_Gadget_BackColor, #White) r(loop,2)=StringGadget(#PB_Any, breite/2 - 23,(310 + (loop * 40)),046,0030, "",#PB_String_BorderLess|#PB_String_ReadOnly|#PB_Text_Center) SetGadgetColor(r(loop,2), #PB_Gadget_BackColor, #White) r(loop,3)=StringGadget(#PB_Any, breite/2 + 28,(310 + (loop * 40)),015,0030, "",#PB_String_BorderLess|#PB_String_ReadOnly|#PB_Text_Center) SetGadgetColor(r(loop,3), #PB_Gadget_BackColor, #White) Next SetGadgetFont(#PB_Default, FontID(2)) #DATEI_REPORT = 1 If ReadFile(#DATEI_REPORT, "Mitglieder.txt") While Eof(#DATEI_REPORT) = #False name.s=ReadString(#DATEI_REPORT) For loop=0 To 5 AddGadgetItem(h(loop,1), -1, name.s) Next Wend CloseFile(#DATEI_REPORT) EndIf SetGadgetFont(#PB_Default, FontID(1)) ; HAUPTINTERFACE ZEICHNEN ENDE--------------------------------------------------------------------- ;##################################################### Repeat Event = WaitWindowEvent() If GetActiveWindow()=#HAUPT Select Event Case #PB_Event_SizeWindow windowresize() Case #PB_Event_Gadget Select EventGadget() Case #BUTTON_EXIT Quit() EndSelect Case #PB_Event_CloseWindow Quit() EndSelect EndIf Until Quit = 1 EndIf Else ; Bildschirmauflösung testen MessageRequester("Auflösung", "Das Programm erfordert mind. eine Auflösung"+#CRLF$+"von 1024 x 768 (4:3) oder 1280 x 720 (16:9)" , #PB_MessageRequester_Ok) EndIf End ; IDE Options = PureBasic 4.60 (Windows - x86) ; CursorPosition = 212 ; FirstLine = 192 ; Folding = - ; EnableXP