Connaissez-vous une solution pour savoir si une option a été cochée, sans faire
Case #Option_1,
Case #Option_2,
Etc...
Code : Tout sélectionner
Select EventGadget()
Case #Option_1 To #Option_20
If Str(GetGadgetState(X)) = Reponse(X)
Vrai()
Else
Faux()
EndIf
EndSelect
voici mon code, pour l'instant, vous comprendrez que je travaille toujours pour l'éveil de mes petits enfants :
Code : Tout sélectionner
;{- Enumerations / DataSections
;{ Windows
Enumeration
#Fenetre_principale
EndEnumeration
;}
;{ Gadgets
Enumeration
#Option_1
#Option_2
#Option_3
#Option_4
#Option_5
#Option_6
#Option_7
#Option_8
#Option_9
#Option_10
#Option_11
#Option_12
#Option_13
#Option_14
#Option_15
#Option_16
#Option_17
#Option_18
#Option_19
#Option_20
#Txt_1
#Txt_2
#Txt_3
#Txt_4
#Txt_5
#Txt_6
#Txt_7
#Txt_8
#Txt_9
#Txt_10
#Container_0
#Container_1
#Container_2
#Container_3
#Container_4
#Container_5
#Container_6
#Container_7
#Container_8
#Container_9
EndEnumeration
Enumeration Police
#Police_Txt_1
#Police_Txt_2
#Police_Txt_3
#Police_Txt_4
#Police_Txt_5
#Police_Txt_6
#Police_Txt_7
#Police_Txt_8
#Police_Txt_9
#Police_Txt_10
EndEnumeration
;}
Global Event, X
Global Dim Question.s(9)
Global Dim Reponse.s(9)
;}
Procedure Lire_les_donnees()
Restore Donnees
For X = 0 To 9
Read.s Question(X)
Read.s Reponse(X)
Next
EndProcedure
Procedure Vrai()
MessageRequester("Info","Bonne réponse"+#LF$+#LF$+"BRAVO")
EndProcedure
Procedure Faux()
MessageRequester("Info","Mauvaise réponse"+#LF$+#LF$+"ATTENTION")
EndProcedure
Procedure Ouvrir_Fenetre_principale()
If OpenWindow(#Fenetre_principale, 450, 40, 445, 480, "Reconnaître les noms", #PB_Window_SystemMenu|#PB_Window_TitleBar|#PB_Window_ScreenCentered)
ContainerGadget(#Container_0, 5, 5, 215, 90, #PB_Container_Raised)
TextGadget(#Txt_1, 10, 5, 190, 24, Question(0))
OptionGadget(#Option_1, 60, 30, 100, 15, "C'est un nom")
OptionGadget(#Option_2, 60, 50, 115, 15, "Ce n'est pas un nom")
CloseGadgetList()
ContainerGadget(#Container_1, 5, 100, 215, 90, #PB_Container_Raised)
TextGadget(#Txt_2, 10, 5, 190, 24, Question(1))
OptionGadget(#Option_3, 60, 30, 100, 15, "C'est un nom")
OptionGadget(#Option_4, 60, 50, 115, 15, "Ce n'est pas un nom")
CloseGadgetList()
ContainerGadget(#Container_2, 5, 195, 215, 90, #PB_Container_Raised)
TextGadget(#Txt_3, 10, 5, 190, 24, Question(2))
OptionGadget(#Option_5, 60, 30, 100, 15, "C'est un nom")
OptionGadget(#Option_6, 60, 50, 115, 15, "Ce n'est pas un nom")
CloseGadgetList()
ContainerGadget(#Container_3, 5, 290, 215, 90, #PB_Container_Raised)
TextGadget(#Txt_4, 10, 5, 190, 24, Question(3))
OptionGadget(#Option_7, 60, 30, 100, 15, "C'est un nom")
OptionGadget(#Option_8, 60, 50, 115, 15, "Ce n'est pas un nom")
CloseGadgetList()
ContainerGadget(#Container_4, 5, 385, 215, 90, #PB_Container_Raised)
TextGadget(#Txt_5, 10, 5, 190, 24, Question(4))
OptionGadget(#Option_9, 60, 30, 100, 15, "C'est un nom")
OptionGadget(#Option_10, 60, 50, 115, 15, "Ce n'est pas un nom")
CloseGadgetList()
ContainerGadget(#Container_5, 225, 5, 215, 90, #PB_Container_Raised)
TextGadget(#Txt_6, 10, 5, 190, 24, Question(5))
OptionGadget(#Option_11, 60, 30, 100, 15, "C'est un nom")
OptionGadget(#Option_12, 60, 50, 115, 15, "Ce n'est pas un nom")
CloseGadgetList()
ContainerGadget(#Container_6, 225, 100, 215, 90, #PB_Container_Raised)
TextGadget(#Txt_7, 10, 5, 190, 24, Question(6))
OptionGadget(#Option_13, 60, 30, 100, 15, "C'est un nom")
OptionGadget(#Option_14, 60, 50, 115, 15, "Ce n'est pas un nom")
CloseGadgetList()
ContainerGadget(#Container_7, 225, 195, 215, 90, #PB_Container_Raised)
TextGadget(#Txt_8, 10, 5, 190, 24, Question(7))
OptionGadget(#Option_15, 60, 30, 100, 15, "C'est un nom")
OptionGadget(#Option_16, 60, 50, 115, 15, "Ce n'est pas un nom")
CloseGadgetList()
ContainerGadget(#Container_8, 225, 290, 215, 90, #PB_Container_Raised)
TextGadget(#Txt_9, 10, 5, 190, 24, Question(8))
OptionGadget(#Option_17, 60, 30, 100, 15, "C'est un nom")
OptionGadget(#Option_18, 60, 50, 115, 15, "Ce n'est pas un nom")
CloseGadgetList()
ContainerGadget(#Container_9, 225, 385, 215, 90, #PB_Container_Raised)
TextGadget(#Txt_10, 10, 5, 190, 24, Question(9))
OptionGadget(#Option_19, 60, 30, 100, 15, "C'est un nom")
OptionGadget(#Option_20, 60, 50, 115, 15, "Ce n'est pas un nom")
CloseGadgetList()
SetGadgetFont(#Txt_1, LoadFont(#Police_Txt_1, "Verdana", 12, #PB_Font_Bold|#PB_Font_HighQuality))
SetGadgetFont(#Txt_2, LoadFont(#Police_Txt_2, "Verdana", 12, #PB_Font_Bold|#PB_Font_HighQuality))
SetGadgetFont(#Txt_3, LoadFont(#Police_Txt_3, "Verdana", 12, #PB_Font_Bold|#PB_Font_HighQuality))
SetGadgetFont(#Txt_4, LoadFont(#Police_Txt_4, "Verdana", 12, #PB_Font_Bold|#PB_Font_HighQuality))
SetGadgetFont(#Txt_5, LoadFont(#Police_Txt_5, "Verdana", 12, #PB_Font_Bold|#PB_Font_HighQuality))
SetGadgetFont(#Txt_6, LoadFont(#Police_Txt_6, "Verdana", 12, #PB_Font_Bold|#PB_Font_HighQuality))
SetGadgetFont(#Txt_7, LoadFont(#Police_Txt_7, "Verdana", 12, #PB_Font_Bold|#PB_Font_HighQuality))
SetGadgetFont(#Txt_8, LoadFont(#Police_Txt_8, "Verdana", 12, #PB_Font_Bold|#PB_Font_HighQuality))
SetGadgetFont(#Txt_9, LoadFont(#Police_Txt_9, "Verdana", 12, #PB_Font_Bold|#PB_Font_HighQuality))
SetGadgetFont(#Txt_10, LoadFont(#Police_Txt_10, "Verdana", 12, #PB_Font_Bold|#PB_Font_HighQuality))
EndIf
EndProcedure
Lire_les_donnees()
Ouvrir_Fenetre_principale()
;{-Boucle principale
Repeat
Event = WaitWindowEvent()
Select Event
; ///////////////////
Case #PB_Event_Gadget
Select EventGadget()
Case #Option_1 To #Option_20
If Str(GetGadgetState(X)) = Reponse(X)
Vrai()
Else
Faux()
EndIf
EndSelect
; ////////////////////////
Case #PB_Event_CloseWindow
Select EventWindow()
Case #Fenetre_principale
CloseWindow(#Fenetre_principale)
Break
EndSelect
EndSelect
ForEver
;
;}
DataSection
Donnees:
Data.s "nager","0","le chat","1","une armoire","1","avant","0","un cadeau","1"
Data.s "une tante","1","depuis","0","un caramel","1","une femme","1","fortement","0"
EndDataSection