juste apèrs avoir appuyé sur le boutton de calcul, quand je bouge la souris sur la fenêtre c'est considéré comme un évennement et ça raffiche le résultat a toute vitesse (le debug que j'ai mis exprès en témoigne quand on bouge la souris sur la fenêtre, le résultat arrêtte pas de se réafficher) ce qui a pour effet de faire scintiller ce résultat.... comment éviter ça? :S
qu'es ske j'ai encore fais? ^^
donc voila:
Code : Tout sélectionner
DefType.f
Enumeration
#Window_0
#String_0
#String_1
#Button_0
#Combo_0
#Text_0
#Text_1
#Text_2
#Text_3
#Text_4
EndEnumeration
If OpenWindow(#Window_0, 353, 262, 384, 173, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered , "Calculatrice")
If CreateGadgetList(WindowID(#Window_0))
StringGadget(#String_0, 110, 10, 260, 25, "", #PB_String_Numeric)
StringGadget(#String_1, 110, 70, 260, 25, "", #PB_String_Numeric)
ButtonGadget(#Button_0, 140, 130, 100, 25, "Calculer")
ComboBoxGadget(#Combo_0, 110, 40, 60, 90)
AddGadgetItem(#Combo_0, -1, "+")
AddGadgetItem(#Combo_0, 0, "-")
AddGadgetItem(#Combo_0, 1, "*")
AddGadgetItem(#Combo_0, 2, "/")
TextGadget(#Text_0, 10, 10, 80, 15, "Premier chiffre :")
TextGadget(#Text_1, 10, 40, 70, 15, "Signe :")
TextGadget(#Text_2, 10, 70, 90, 15, "Deuxième chiffre :")
TextGadget(#Text_3, 10, 110, 90, 15, "Resultat :")
TextGadget(#Text_4, 110, 110, 90, 15, "")
EndIf
EndIf
Repeat
; WaitWindowEvent() ;on attend qu'il y ai un evennement sur la fenêtre
If EventGadgetID() = #Button_0 ;si on clique sur le boutton "calculer"
Chiffre1$ = GetGadgetText(#String_0)
Signe$ = GetGadgetText(#Combo_0)
Chiffre2$ = GetGadgetText(#String_1)
Chiffre_1 = Val(Chiffre1$)
Chiffre_2 = Val(Chiffre2$)
Select Signe$
Case "+"
SetGadgetText(#Text_4, StrF(Chiffre_1 + Chiffre_2))
Debug Chiffre_1 + Chiffre_2
Case "-"
SetGadgetText(#Text_4, StrF(Chiffre_1 - Chiffre_2))
Debug Chiffre_1 - Chiffre_2
Case "*"
SetGadgetText(#Text_4, StrF(Chiffre_1 * Chiffre_2))
Debug Chiffre_1 * Chiffre_2
Case "/"
SetGadgetText(#Text_4, StrF(Chiffre_1 / Chiffre_2))
Debug Chiffre_1 / Chiffre_2
EndSelect
EndIf
Until WaitWindowEvent() = #PB_Event_CloseWindow
CloseWindow(#Window_0)
End