Je fais pour mes petits enfants qui ont maintenant l'âge de rentrer au CP des petits programmes d'éveil et je bute sur un problème très simple, il s'agit de mots de 2 syllabes dont il faut retrouver les deux parties que j'ai placés dans deux combos, le problème qui se pose, c'est que je souhaiterais qu'ils puissent retrouver les mots même dans l'ordre inverse, par exemple : lama, ils cliquent d'abord sur la ou ma et ensuite sur la partie manquante, mais ils doivent recevoir un message leur indiquant s'ils ont on non choisi une bonne syllabe du mot à trouver et les combos s'effacent quand ils ont trouver les deux parties et le mot trouvé s'affiche dans la case prévue à cet effet.
Mon soucis, c'est que s'ils ont trouvé une bonne partie, c'est qu'ils peuvent mettre n'importe quoi, car le message envoyé dit toujours que c'est une bonne réponse, c'est pourquoi je vient solliciter votre aides bienveillante et je vous en remercie grandement, car ça va m'aider pour la suite aussi.








Code : Tout sélectionner
;Mots de 2 syllabes simples
;Créateur : Micoute
;Date : 7 août 2017
;Os : Windows 10 64 bits
;IDE : PureBasic 5.60 (x86)
Enumeration Fenetres
#Fenetre_principale
EndEnumeration
Enumeration Gadgets
#Img_Lama
#Img_Lune
#Img_Robe
#Img_Tube
#Img_Moto
#Img_Cage
#Img_Cube
#Img_Pile
#Img_Luge
#Txt_Titre
#Txt_luronemabela
#Txt_Lama
#Txt_Lune
#Txt_Robe
#Txt_mocatobegetu
#Txt_Tube
#Txt_Moto
#Txt_Cage
#Txt_pilulebegecu
#Txt_Cube
#Txt_Pile
#Txt_Luge
#Txt_Signature
#Str_Lama
#Str_Lune
#Str_Robe
#Str_Tube
#Str_Moto
#Str_Cage
#Str_Cube
#Str_Pile
#Str_Luge
;luronemabela
#Cmb_Lu
#Cmb_Ro
#Cmb_Ne
#Cmb_Ma
#Cmb_Be
#Cmb_La
;mocatobegetu
#Cmb_Mo
#Cmb_Ca
#Cmb_To
#Cmb_Be2
#Cmb_Ge
#Cmb_Tu
;pilulebegecu
#Cmb_Pi
#Cmb_Lu2
#Cmb_Le
#Cmb_Be3
#Cmb_Ge2
#Cmb_Cu
#Ctn_1
#Ctn_2
#Ctn_3
EndEnumeration
Enumeration Images
#ImgId_Lama
#ImgId_Lune
#ImgId_Robe
#ImgId_Tube
#ImgId_Moto
#ImgId_Cage
#ImgId_Cube
#ImgId_Pile
#ImgId_Luge
EndEnumeration
Enumeration Polices
#Police
#Police2
#Police3
EndEnumeration
Enumeration Sons
#Son_Oui
#Son_Non
EndEnumeration
Structure Enonce
Titre.s
Nom.s[3]
EndStructure
UsePNGImageDecoder()
ExamineDesktops()
InitSound()
;Chargement des sons
CatchSound(#Son_Oui, ?Oui, ?Non - ?Oui)
CatchSound(#Son_Non, ?Non, ?FinSon - ?Non)
Global i, LrgEcr, HtEcr, Ecart1, Ecart2, Ecart3, Evenement, Dim Donnee.Enonce(2)
LrgEcr = DesktopWidth(0)
HtEcr = DesktopHeight(0)
LoadFont(#Police, "Arial", 30, #PB_Font_Bold)
LoadFont(#Police2, "Arial", 20, #PB_Font_Bold)
LoadFont(#Police3, "Arial", 15, #PB_Font_Bold)
Procedure Compliment(Note.b = #False)
If Note = #True
PlaySound(#Son_Oui)
Else
PlaySound(#Son_Non)
EndIf
EndProcedure
Procedure Lire_les_donnees()
For i = 0 To ArraySize(Donnee())
Read$ Donnee(i)\Titre
Read$ Donnee(i)\Nom[0]
Read$ Donnee(i)\Nom[1]
Read$ Donnee(i)\Nom[2]
Next i
EndProcedure
Procedure Questionnaire()
If OpenWindow(#Fenetre_principale, 0, 0, 1040, 1030, "Mots de 2 syllabes simples", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
SetGadgetFont(#PB_Default, FontID(#Police))
TextGadget(#Txt_Titre, 20, 0, 1000, 50, "Replace les syllabes dans le bon ordre afin de reconstituer les mots correspondants aux images", #PB_Text_Center|#SS_CENTERIMAGE)
;- Ctn 1
ContainerGadget(#Ctn_1, 0, 60, 1040, 295)
CatchImage(#Img_Lama, ?Lama)
CatchImage(#Img_Lune, ?Lune)
CatchImage(#Img_Robe, ?Robe)
TextGadget(#Txt_luronemabela, 20, 0, 1000, 40, Donnee(0)\Titre, #PB_Text_Center|#SS_CENTERIMAGE)
ImageGadget(#Img_Lama, 20, 40, 320, 236, ImageID(#ImgId_Lama))
ImageGadget(#Img_Lune, 360, 40, 320, 236, ImageID(#ImgId_Lune))
ImageGadget(#Img_Robe, 700, 60, 320, 236, ImageID(#ImgId_Robe))
StringGadget(#Str_Lama, 20, 250, 180, 40, "un ", #SS_CENTERIMAGE)
StringGadget(#Str_Lune, 360, 250, 180, 40, "la ", #SS_CENTERIMAGE)
StringGadget(#Str_Robe, 700, 250, 180, 40, "une ", #SS_CENTERIMAGE)
ComboBoxGadget(#Cmb_La, 200, 250, 70, 40)
ComboBoxGadget(#Cmb_Ma, 270, 250, 70, 40)
ComboBoxGadget(#Cmb_Lu, 540, 250, 70, 40)
ComboBoxGadget(#Cmb_Ne, 610, 250, 70, 40)
ComboBoxGadget(#Cmb_Ro, 880, 250, 70, 40)
ComboBoxGadget(#Cmb_Be, 950, 250, 70, 40)
SetGadgetColor(#Txt_luronemabela, #PB_Gadget_BackColor, $0E8FD2)
For i = #Cmb_Lu To #Cmb_la
AddGadgetItem(i, -1, "lu")
AddGadgetItem(i, -1, "ro")
AddGadgetItem(i, -1, "ne")
AddGadgetItem(i, -1, "ma")
AddGadgetItem(i, -1, "be")
AddGadgetItem(i, -1, "la")
Next i
CloseGadgetList()
;- Ctn 2
ContainerGadget(#Ctn_2, 0, 360, 1040, 325)
CatchImage(#Img_Tube, ?Tube)
CatchImage(#Img_Moto, ?Moto)
CatchImage(#Img_Cage, ?Cage)
TextGadget(#Txt_mocatobegetu, 20, 0, 1000, 40, Donnee(1)\Titre, #PB_Text_Center|#SS_CENTERIMAGE)
ImageGadget(#Img_Tube, 20, 40, 320, 236, ImageID(#ImgId_Tube))
ImageGadget(#Img_Moto, 360, 40, 320, 236, ImageID(#ImgId_Moto))
ImageGadget(#Img_Cage, 700, 40, 320, 236, ImageID(#ImgId_Cage))
StringGadget(#Str_Tube, 20, 290, 180, 40, "un ", #SS_CENTERIMAGE)
StringGadget(#Str_Moto, 360, 290, 180, 40, "une ", #SS_CENTERIMAGE)
StringGadget(#Str_Cage, 700, 290, 180, 40, "une ", #SS_CENTERIMAGE)
ComboBoxGadget(#Cmb_Tu, 200, 290, 70, 40)
ComboBoxGadget(#Cmb_Be2, 270, 290, 70, 40)
ComboBoxGadget(#Cmb_Mo, 540, 290, 70, 40)
ComboBoxGadget(#Cmb_To, 610, 290, 70, 40)
ComboBoxGadget(#Cmb_Ca, 880, 290, 70, 40)
ComboBoxGadget(#Cmb_Ge, 950, 290, 70, 40)
SetGadgetColor(#Txt_mocatobegetu, #PB_Gadget_BackColor, $0E8FD2)
For i = #Cmb_Mo To #Cmb_Tu
AddGadgetItem(i, -1, "mo")
AddGadgetItem(i, -1, "ca")
AddGadgetItem(i, -1, "to")
AddGadgetItem(i, -1, "be")
AddGadgetItem(i, -1, "ge")
AddGadgetItem(i, -1, "tu")
Next i
CloseGadgetList()
;- Ctn 3
ContainerGadget(#Ctn_3, 0, 700, 1040, 275)
CatchImage(#Img_Cube, ?Cube)
CatchImage(#Img_Pile, ?Pile)
CatchImage(#Img_Luge, ?Luge)
TextGadget(#Txt_pilulebegecu, 20, 0, 1000, 40, Donnee(2)\Titre, #PB_Text_Center|#SS_CENTERIMAGE)
ImageGadget(#Img_Cube, 20, 80, 320, 236, ImageID(#ImgId_Cube))
ImageGadget(#Img_Pile, 360, 40, 320, 236, ImageID(#ImgId_Pile))
ImageGadget(#Img_Luge, 700, 60, 320, 236, ImageID(#ImgId_Luge))
StringGadget(#Str_Cube, 20, 240, 180, 40, "un ", #SS_CENTERIMAGE)
StringGadget(#Str_Pile, 360, 240, 180, 40, "une ", #SS_CENTERIMAGE)
StringGadget(#Str_Luge, 700, 240, 180, 40, "une ", #SS_CENTERIMAGE)
ComboBoxGadget(#Cmb_Cu, 200, 240, 70, 40)
ComboBoxGadget(#Cmb_Be3, 270, 240, 70, 40)
ComboBoxGadget(#Cmb_Pi, 540, 240, 70, 40)
ComboBoxGadget(#Cmb_Le, 610, 240, 70, 40)
ComboBoxGadget(#Cmb_Lu2, 880, 240, 70, 40)
ComboBoxGadget(#Cmb_Ge2, 950, 240, 70, 40)
SetGadgetColor(#Txt_pilulebegecu, #PB_Gadget_BackColor, $0E8FD2)
For i = #Cmb_Pi To #Cmb_Cu
AddGadgetItem(i, -1, "pi")
AddGadgetItem(i, -1, "lu")
AddGadgetItem(i, -1, "le")
AddGadgetItem(i, -1, "be")
AddGadgetItem(i, -1, "ge")
AddGadgetItem(i, -1, "cu")
Next i
CloseGadgetList()
TextGadget(#Txt_Signature, 20, 990, 1000, 40, "Ce logiciel a été créé par Micoute", #PB_Text_Center|#SS_CENTERIMAGE)
;Polices
For i = #Str_Lama To #Str_Luge
SetGadgetFont(i, FontID(#Police2))
Next i
For i = #Cmb_Lu To #Cmb_Cu
SetGadgetFont(i, FontID(#Police2))
Next i
SetGadgetFont(#Txt_Titre, FontID(#Police3))
SetGadgetFont(#Txt_Signature, FontID(#Police2))
;Couleurs
SetWindowColor(#Fenetre_principale, $0DD298)
For i = #Ctn_1 To #Ctn_3
SetGadgetColor(i, #PB_Gadget_BackColor, $0DD298)
Next i
SetGadgetColor(#Txt_Titre, #PB_Gadget_BackColor, $0E8FD2)
SetGadgetColor(#Txt_Signature, #PB_Gadget_BackColor, $0E8FD2)
SetGadgetColor(#Txt_Titre, #PB_Gadget_FrontColor, $00FFFF)
EndIf
EndProcedure
Lire_les_donnees()
Questionnaire()
;- Boucle
Repeat
Evenement = WaitWindowEvent()
Select Evenement
Case #PB_Event_Gadget
Select EventGadget()
Case #Cmb_La, #Cmb_Ma
If GetGadgetText(#Cmb_La) = "la" Or GetGadgetText(#Cmb_Ma) = "ma"
If GetGadgetText(#Cmb_La) = "la" And GetGadgetText(#Cmb_Ma) = "ma"
HideGadget(#Cmb_La, 1)
HideGadget(#Cmb_Ma, 1)
SetGadgetText(#Str_Lama, "un " + Donnee(0)\Nom[0])
Compliment(1)
Else
Compliment(0)
EndIf
EndIf
Case #Cmb_Lu, #Cmb_Ne
If GetGadgetText(#Cmb_Lu) = "lu" Or GetGadgetText(#Cmb_Ne) = "ne"
If GetGadgetText(#Cmb_Lu) = "lu" And GetGadgetText(#Cmb_Ne) = "ne"
HideGadget(#Cmb_Lu, 1)
HideGadget(#Cmb_Ne, 1)
SetGadgetText(#Str_Lune, "la " + Donnee(0)\Nom[1])
EndIf
Compliment(1)
Else
Compliment(0)
EndIf
Case #Cmb_Ro, #Cmb_Be
If GetGadgetText(#Cmb_Ro) = "ro" Or GetGadgetText(#Cmb_Be) = "be"
If GetGadgetText(#Cmb_Ro) = "ro" And GetGadgetText(#Cmb_Be) = "be"
HideGadget(#Cmb_Ro, 1)
HideGadget(#Cmb_Be, 1)
SetGadgetText(#Str_Robe, "une " + Donnee(0)\Nom[2])
EndIf
Compliment(1)
Else
Compliment(0)
EndIf
Case #Cmb_Tu, #Cmb_Be2
If GetGadgetText(#Cmb_Tu) = "tu" Or GetGadgetText(#Cmb_Be2) = "be"
If GetGadgetText(#Cmb_Tu) = "tu" And GetGadgetText(#Cmb_Be2) = "be"
HideGadget(#Cmb_Tu, 1)
HideGadget(#Cmb_Be2, 1)
SetGadgetText(#Str_Tube, "un " + Donnee(1)\Nom[0])
EndIf
Compliment(1)
Else
Compliment(0)
EndIf
Case #Cmb_Mo, #Cmb_To
If GetGadgetText(#Cmb_Mo) = "mo" Or GetGadgetText(#Cmb_To) = "to"
If GetGadgetText(#Cmb_Mo) = "mo" And GetGadgetText(#Cmb_To) = "to"
HideGadget(#Cmb_Mo, 1)
HideGadget(#Cmb_To, 1)
SetGadgetText(#Str_Moto, "une " + Donnee(1)\Nom[1])
EndIf
Compliment(1)
Else
Compliment(0)
EndIf
Case #Cmb_Ca, #Cmb_Ge
If GetGadgetText(#Cmb_Ca) = "ca" Or GetGadgetText(#Cmb_Ge) = "ge"
If GetGadgetText(#Cmb_Ca) = "ca" And GetGadgetText(#Cmb_Ge) = "ge"
HideGadget(#Cmb_Ca, 1)
HideGadget(#Cmb_Ge, 1)
SetGadgetText(#Str_Cage, "une " + Donnee(1)\Nom[2])
EndIf
Compliment(1)
Else
Compliment(0)
EndIf
Case #Cmb_Cu, #Cmb_Be3
If GetGadgetText(#Cmb_Cu) = "cu" Or GetGadgetText(#Cmb_Be3) = "be"
If GetGadgetText(#Cmb_Cu) = "cu" And GetGadgetText(#Cmb_Be3) = "be"
HideGadget(#Cmb_Cu, 1)
HideGadget(#Cmb_Be3, 1)
SetGadgetText(#Str_Cube, "un " + Donnee(2)\Nom[0])
EndIf
Compliment(1)
Else
Compliment(0)
EndIf
Case #Cmb_Pi, #Cmb_Le
If GetGadgetText(#Cmb_Pi) = "pi" Or GetGadgetText(#Cmb_Le) = "le"
If GetGadgetText(#Cmb_Pi) = "pi" And GetGadgetText(#Cmb_Le) = "le"
HideGadget(#Cmb_Pi, 1)
HideGadget(#Cmb_Le, 1)
SetGadgetText(#Str_Pile, "une " + Donnee(2)\Nom[1])
EndIf
Compliment(1)
Else
Compliment(0)
EndIf
Case #Cmb_Lu2, #Cmb_Ge2
If GetGadgetText(#Cmb_Lu2) = "lu" Or GetGadgetText(#Cmb_Ge2) = "ge"
If GetGadgetText(#Cmb_Lu2) = "lu" And GetGadgetText(#Cmb_Ge2) = "ge"
HideGadget(#Cmb_Lu2, 1)
HideGadget(#Cmb_Ge2, 1)
SetGadgetText(#Str_Luge, "une " + Donnee(2)\Nom[2])
EndIf
Compliment(1)
Else
Compliment(0)
EndIf
EndSelect
Case #PB_Event_CloseWindow
Select EventWindow()
Case #Fenetre_principale
CloseWindow(#Fenetre_principale)
Break
EndSelect
EndSelect
ForEver
DataSection
Data.s "lu ro ne ma be la", "lama", "lune", "robe"
Data.s "mo ca to be ge tu", "tube", "moto", "cage"
Data.s "pi lu le be ge cu", "cube", "pile", "luge"
Lama:
IncludeBinary #PB_Compiler_FilePath + "\Images\Lama.png"
Lune:
IncludeBinary #PB_Compiler_FilePath + "\Images\Lune.png"
Robe:
IncludeBinary #PB_Compiler_FilePath + "\Images\Robe.png"
Tube:
IncludeBinary #PB_Compiler_FilePath + "\Images\Tube.png"
Moto:
IncludeBinary #PB_Compiler_FilePath + "\Images\Moto.png"
Cage:
IncludeBinary #PB_Compiler_FilePath + "\Images\Cage.png"
Cube:
IncludeBinary #PB_Compiler_FilePath + "\Images\Cube.png"
Pile:
IncludeBinary #PB_Compiler_FilePath + "\Images\Pile.png"
Luge:
IncludeBinary #PB_Compiler_FilePath + "\Images\Luge.png"
Fin:
Oui:
IncludeBinary "D:\Programmation\Prg Perso\S\Sons\Divers\Oui.wav"
Non:
IncludeBinary "D:\Programmation\Prg Perso\S\Sons\Divers\Non.wav"
FinSon:
EndDataSection