Pour le fun une petite horloge style 1975 modifiée 1980

Je ne sait pas si quelqu’un a déjà fait la même chose en programmant de cette façon.
J'ai fait un peu ceci a l'arrache. A vous les améliorations.
Code : Tout sélectionner
;essais Horloge digit 7 segments MLD le 7/11/2022
;¤¤¤¤ Assignation des gadgets ¤¤¤¤
#Ma_fen = 1
Enumeration 10
#seg_11:#seg_12:#seg_13:#seg_14:#seg_15:#seg_16: #seg_17
EndEnumeration
Enumeration 20
#seg_21:#seg_22:#seg_23:#seg_24:#seg_25:#seg_26:#seg_27
EndEnumeration
Enumeration 30
#seg_31:#seg_32:#seg_33:#seg_34:#seg_35:#seg_36:#seg_37
EndEnumeration
Enumeration 40
#seg_41:#seg_42:#seg_43:#seg_44:#seg_45:#seg_46:#seg_47
EndEnumeration
Macro clf(gad)
SetGadgetColor(gad,#PB_Gadget_BackColor,$FF309B)
EndMacro
Macro hd(gad,eta)
HideGadget(gad,eta)
EndMacro
Procedure fseg(g,nb$)
If nb$ = "0":hd(g + 1,0):hd(g + 2,1):hd(g + 3,0):hd(g + 4,0):hd(g + 5,0):hd(g + 6,0):hd(g + 7,0):EndIf
If nb$ = "1":hd(g + 1,1):hd(g + 2,1):hd(g + 3,1):hd(g + 4,0):hd(g + 5,0):hd(g + 6,1):hd(g + 7,1):EndIf
If nb$ = "2":hd(g + 1,0):hd(g + 2,0):hd(g + 3,0):hd(g + 4,0):hd(g + 5,1):hd(g + 6,1):hd(g + 7,0):EndIf
If nb$ = "3":hd(g + 1,0):hd(g + 2,0):hd(g + 3,0):hd(g + 4,0):hd(g + 5,0):hd(g + 6,1):hd(g + 7,1):EndIf
If nb$ = "4":hd(g + 1,1):hd(g + 2,0):hd(g + 3,1):hd(g + 4,1):hd(g + 5,0):hd(g + 6,0):hd(g + 7,1):EndIf
If nb$ = "5":hd(g + 1,0):hd(g + 2,0):hd(g + 3,0):hd(g + 4,1):hd(g + 5,0):hd(g + 6,0):hd(g + 7,1):EndIf
If nb$ = "6":hd(g + 1,0):hd(g + 2,0):hd(g + 3,0):hd(g + 4,1):hd(g + 5,0):hd(g + 6,0):hd(g + 7,0):EndIf
If nb$ = "7":hd(g + 1,0):hd(g + 2,1):hd(g + 3,1):hd(g + 4,0):hd(g + 5,0):hd(g + 6,1):hd(g + 7,1):EndIf
If nb$ = "8":hd(g + 1,0):hd(g + 2,0):hd(g + 3,0):hd(g + 4,0):hd(g + 5,0):hd(g + 6,0):hd(g + 7,0):EndIf
If nb$ = "9":hd(g + 1,0):hd(g + 2,0):hd(g + 3,0):hd(g + 4,0):hd(g + 5,0):hd(g + 6,0):hd(g + 7,1):EndIf
EndProcedure
Procedure TimerProc(hwnd.l, uMsg.l, idEvent.l, dwTime.l)
Static m$ = "10": Static dm$ = "7":Static h$ = "10":Static dh$ = "3"
Select uMsg
Case #WM_TIMER
dt$ = FormatDate("%hh%ii", Date())
If Right(dt$,1) <> m$:m$ = Right(dt$,1):fseg(40,m$):EndIf
If Mid(dt$,3,1) <> dm$:dm$ = Mid(dt$,3,1):fseg(30,dm$):EndIf
If Mid(dt$,2,1) <> h$:h$ = Mid(dt$,2,1):fseg(20,h$):EndIf
If Left(dt$,1) <> dh$:dh$ = Left(dt$,1):fseg(10,dh$):EndIf
EndSelect
EndProcedure
OpenWindow(1,740,175,700,250,"DIGIT",#PB_Window_MinimizeGadget|#NUL|#NUL|#NUL)
SetWindowColor(1,$080FF)
StickyWindow(1,1)
;Vos gadgets ici
hsg1 = 50
For hz = 1 To 3
TextGadget(hz +10,50,hsg1,100,2,""):clf(hz + 10)
TextGadget(hz +20,200,hsg1,100,2,""):clf(hz + 20)
TextGadget(hz +30,400,hsg1,100,2,""):clf(hz + 30)
TextGadget(hz +40,550,hsg1,100,2,""):clf(hz + 40)
hsg1 = hsg1 + 50
Next
hsg1 = 50
For vtd = 4 To 5
TextGadget(vtd +10,150,hsg1,2,50,""):clf(vtd +10)
TextGadget(vtd +20,300,hsg1,2,50,""):clf(vtd +20)
TextGadget(vtd +30,500,hsg1,2,50,""):clf(vtd +30)
TextGadget(vtd +40,650,hsg1,2,50,""):clf(vtd +40)
hsg1 = hsg1 + 50
Next
hsg1 = 50
For vtg = 6 To 7
TextGadget(vtg +10,50,hsg1,2,50,""):clf(vtg +10)
TextGadget(vtg +20,200,hsg1,2,50,""):clf(vtg +20)
TextGadget(vtg +30,400,hsg1,2,50,""):clf(vtg +30)
TextGadget(vtg +40,550,hsg1,2,50,""):clf(vtg +40)
hsg1 = hsg1 + 50
Next
SetTimer_ (WindowID (1) ,0,1000, @TimerProc()) ; envoie un evenement toutes les 1000 millisecondes
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
End