Ciao Pat... J'ai retrouvé un petit algorithme pour trouver la date de Pâques seulement pour le calendrier grégorien... C'est sympa.pat a écrit :A beruska.
Merci pour cette nouvelle contribution.
Au niveau des dates, cela va faire des heureux.
Code : Tout sélectionner
; by beruska 2007 - revu PB v.4.51
;======================================
Enumeration
#fenetre_principale
#txt_titolo
#txt_anno
#txt_beber
#fin
#annee
#lst_pasqua
#font1
EndEnumeration
LoadFont(#font1,"arial",14,#PB_Font_Bold)
Procedure Ouvre_Fenetre_principale()
If OpenWindow ( #fenetre_principale , 0, 0, 370, 210, "" , #PB_Window_ScreenCentered | #PB_Window_BorderLess)
TextGadget(#txt_titolo,20,15,330,20,"Calcul de la date de Pâques",#PB_Text_Center)
TextGadget(#txt_anno,20,75,100,15,"Choisir l'année",#PB_Text_Center)
TextGadget(#txt_beber,20,190,100,15,"by beruska ©2007",#PB_Text_Center)
ButtonGadget(#fin, 350,5,15,15,"X")
StringGadget(#annee,20,50,100,20,"")
ListViewGadget(#lst_pasqua,150,50,200,140)
SetGadgetFont(#txt_titolo, FontID(#font1))
For x = #txt_titolo To #txt_beber
SetGadgetColor(x,#PB_Gadget_BackColor,RGB(0,80,80))
SetGadgetColor(x,#PB_Gadget_FrontColor,RGB(255,255,255))
Next
SetGadgetColor(#annee, #PB_Gadget_BackColor, RGB(255, 255, 200))
SetGadgetColor(#lst_pasqua, #PB_Gadget_BackColor, RGB(255, 255, 200))
SetWindowColor(#fenetre_principale,RGB(0,80,80));(#W0,RGB(0,80,80))
EndIf
EndProcedure
Procedure.l Calcul_Paques(x) ; valable seulement pour le calendrier grégorien (après 1582)
For r = x To x+9 ; calcul sur 10 années consécutives
If r >= 2400
m = 25: n = 1
ElseIf r >= 2300
m = 26: n = 1
ElseIf r >= 2200
m = 25: n = 0
ElseIf r >= 2100
m = 24: n = 6
ElseIf r >= 1900
m = 24: n = 5
ElseIf r >= 1800
m = 23: n = 4
ElseIf r >= 1700
m = 23: n = 3
ElseIf r >= 1583
m = 22: n = 2
EndIf
a = r % 4
b = r % 7
c = r % 19
d = (c*19 + m) % 30
e = (a*2 + b*4 + d*6 + n) %7
p = 22 + d + e
If p < 32
AddGadgetItem(#lst_pasqua,-1,"Pâques " + Str(r) + " est le " + Str(p) + " mars")
Else
p - 31
If p = 25 And c > 10 And d = 28 And e = 6
p-7
EndIf
AddGadgetItem(#lst_pasqua,-1,"Pâques " + Str(r) + " est le " + Str(p) + " avril")
EndIf
Next
EndProcedure
;=====================================
;- Debut du programme
Ouvre_Fenetre_principale()
AddKeyboardShortcut(#fenetre_principale, #PB_Shortcut_Return, 15)
AddKeyboardShortcut(#fenetre_principale, #PB_Shortcut_Escape, 99)
SetActiveGadget(#annee)
Repeat
Event = WaitWindowEvent ()
anno = Val(GetGadgetText(#annee))
If event = #PB_Event_Menu
Select EventMenu()
Case 99
quit = #True
Case 15
If GetFocus_() = GadgetID(#annee)
ClearGadgetItems(#lst_pasqua)
Calcul_Paques(anno)
SetGadgetText(#annee,"")
SetActiveGadget(#annee)
EndIf
EndSelect
EndIf
If event = #PB_Event_Gadget
Select EventGadget()
Case #fin
quit = #True
EndSelect
EndIf
If event = #PB_Event_CloseWindow
quit = #True
EndIf
Until quit = #True ; Event = #PB_Event_CloseWindow
End