j'aimerais que vous m'aidez à resolvez ce probleme qui me rend nerveux depuis quelques jours mon code devait me permettre de limiter le nombre d'opération à 5 donc apres 5 operations donc apres il doit m'afficher "toutes les operations sont terminées
merci pour votre aide
Code : Tout sélectionner
;programme de pure basic 3.80
Enumeration
#window_0
#bouton_1
#bouton_2
#bouton_3
#Gadget
#chaine_1
#chaine_2
#chaine_3 ;= 15
#Text
#Text_0
#Text_1
EndEnumeration
NbElements = 2
Global Resultat.l
Global Resultat2.l
Global Resultat$
Global Resultat2$
;Dim Array.l(#NbElements)
If OpenWindow(#window_0,443,86,350,260,#PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "Davida")
If CreateGadgetList(WindowID(0))
LoadFont(10,"Arial", 14, #PB_Font_Bold)
SetGadgetFont(#PB_Default,FontID())
;StringGadget(#chaine_1,180, 35,150,20,"",#PB_String_Numeric|#PB_Text_Right)
;StringGadget(#chaine_2,180, 95,150,20,"",#PB_String_Numeric|#PB_Text_Right)
;StringGadget(#chaine_3,180, 155,150,20,"0",#PB_String_Numeric|#PB_Text_Right
StringGadget(#chaine_1,220, 35,110,25,"",#PB_String_ReadOnly|#PB_Text_Right)
StringGadget(#chaine_2,220, 95,110,25,"",#PB_String_ReadOnly|#PB_Text_Right)
StringGadget(#chaine_3,220, 155,110,25,"0",#PB_String_Numeric|#PB_Text_Right)
;LoadFont(3,"Arial",14.5,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_Underline)
;SetGadgetFont(#PB_Default,FontID())
LoadFont(11,"Arial",9,#PB_Font_Bold)
SetGadgetFont(#PB_Default,FontID())
ButtonGadget(#bouton_1, 230, 220, 110, 22, "Quitter")
ButtonGadget(#bouton_2, 10, 220, 110, 22, "Commencer",#PB_EventType_LeftClick)
ButtonGadget(#bouton_3, 120, 220, 110, 22, "Verifier")
TextGadget(#Text,100, 40,160,20,"1er Nombre :")
TextGadget(#Text_0,90, 105,170,20,"2ème Nombre :")
TextGadget(#Text_1,125, 165,55,20,"Resultat :")
;LoadFont(3,"Arial",14.5,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_Underline)
SetGadgetFont(#PB_Default,FontID())
LoadFont(11,"Arial",16,#PB_Font_Bold)
SetGadgetFont(#PB_Default,FontID())
TextGadget(#Text_0,185, 65,20,20,"+")
EndIf
EndIf
Procedure Autres_operations()
Autres_operations :
Resultat.l = Random(7000)
Resultat2.l = Random(4560)
Resultat$ = Str (Resultat.l)
Resultat2$ = Str (Resultat2.l);TextGadget(#Text_1,10, 125,150,20,"Alleatoire",#PB_String_Numeric)
SetGadgetText(#chaine_1, Str (Val(Resultat$)))
SetGadgetText(#chaine_2, Str (Val(Resultat2$)))
DisableGadget(#bouton_2,1)
nombre = 2
EndProcedure
;Procedure Arret_Operation()
;condition = 0
; Repeat
; Goto Autres_operations :
;condition = condition + 1
; Until GetGadgetText(#chaine_3) <= Str(7000)
;Return
; rep_2 = MessageRequester("Thank","Bravo toutes les oprations sont terminées ",#PB_MessageRequester_Ok)
;EndProcedure
;Procedure Debut_operation()
;EndProcedure
Repeat
EventID = WaitWindowEvent()
If Event = #PB_EventGadget
EndIf
Select EventID;Gadget()
Case #PB_Event_Gadget
Select EventGadgetID()
Case 1 : Event = #bouton_1
;Affichage des nombres alléatoires
Case 2: Evebt = #bouton_2
Autres_operations()
Case 3 : Event3 = #bouton_3
If GetGadgetText(#chaine_3) = "0" Or GetGadgetText(#chaine_3) = ""
MessageRequester("Désolé","La case est vide,Entrez d'abord votre réponse.",#PB_MessageRequester_Ok)
Else
If GetGadgetText(#chaine_3) <> Str (Val(Resultat$) + Val(Resultat2$))
rep = MessageRequester("Désolé","Mauvaise réponse. Voulez-vous voir la bonne réponse ?",#PB_MessageRequester_YesNo)
If rep = 6
MessageRequester("Reponse","La bonne réponse est:" + Str (Val(Resultat$) + Val(Resultat2$)),#PB_MessageRequester_Ok)
SetGadgetText(#chaine_3,"")
Else
If rep = 7
SetGadgetText(#chaine_3,"")
EndIf
EndIf
Else
If GetGadgetText(#chaine_3) = Str (Val(Resultat$) + Val(Resultat2$))
rep_2 = MessageRequester("Thank","Bravo",#PB_MessageRequester_Ok)
;SetGadgetText(#chaine_3,"")
;debut arret op
;nombre = 0
;nombre2 = 4
;While nombre2 = 4
;nombre = nombre + 1
;Else
For nombre = 1 To 3
Autres_operations()
Next nombre
If nombre = 4
;nombre2 = 5
;Else
MessageRequester("Désolé","Toutes les opérations sont terminées.",#PB_MessageRequester_Ok)
EndIf
;Wend
;fin op
EndIf
EndIf
EndIf
EndSelect
Case #PB_EventCloseWindow
Event = #bouton_1
EndSelect
Until Event = #bouton_1