rebol[ Title: "Révisons nos tables" file: "Tables" version: 1.0.0 date: 10-10-2003 home: http://gchenas.free.fr file: "Tables.r" author: "gael chenas" description: "Permet de réviser les tables de multiplications" ] chiffre1: make string! "" cpt_total: 0 cpt_bon: 0 ;############################ fen_case ########################################## fen_case: layout [ size 380x120 backcolor 0.120.200 indent 5 vh1 "Il faut choisir au moins une table" indent 110 cmdquit: button 100x50 "OK" #"^M"[unview] ] ;############################ fen ############################################## fen: layout [ size 500x280 backcolor 0.120.200 pad 0x10 across c1: check "1" [either c1/data = true [append chiffre1 c1/text][ ]] text "1" below across c2: check "2" [either c2/data = true [append chiffre1 c2/text][chiffre1: exclude chiffre1 c2/text]] text "2" below across c3: check "3" [either c3/data = true [append chiffre1 c3/text][ chiffre1: exclude chiffre1 c3/text]] text "3" below across c4: check "4" [either c4/data = true [append chiffre1 c4/text][chiffre1: exclude chiffre1 c4/text ]] text "4" below across c5: check "5" [either c5/data = true [append chiffre1 c5/text][chiffre1: exclude chiffre1 c5/text ]] text "5" below across c6: check "6" [either c6/data = true [append chiffre1 c6/text][ chiffre1: exclude chiffre1 c6/text]] text "6" below across c7: check "7" [either c7/data = true [append chiffre1 c7/text][chiffre1: exclude chiffre1 c7/text ]] text "7" below across c8: check "8" [either c8/data = true [append chiffre1 c8/text][ chiffre1: exclude chiffre1 c8/text]] text "8" below across c9: check "9" [either c9/data = true [append chiffre1 c9/text][chiffre1: exclude chiffre1 c9/text ]] text "9" across pad 20x-220 lab1: label 380x40 "Révisons les tables de multiplications" white font-size 20 below pad 0x10 across indent 100 info1: info 100x50 "" font-size 32 center indent 50 nombre: field 100x50 "" 255.255.255 font-size 32 center white below across indent 120 ;########################## cmdvalid ##################################### cmdvalid: button 100x50 "Valider" #"^M" [ if nombre/text = "" [return none] either resultat = to-integer nombre/text [ cpt_total: cpt_total + 1 cpt_bon: cpt_bon + 1 focus cmdsuite info2/text: rejoin [cpt_bon "" "/" "" cpt_total] show info2] ; sinon [cpt_total: cpt_total + 1 focus cmdsuite label_resultat/text: rejoin["Le résultat de"" "info1/text " " "est" " " resultat] show label_resultat info2/text: rejoin[ cpt_bon "" "/" "" cpt_total] show info2] ] ;########################### cmdsuite ################################# cmdsuite: button 100x50"Suite" #"^M"[ random/seed now label_resultat/text: "" show label_resultat either chiffre1 = "" [ view/new center-face fen_case][ nombre/text: copy "" show nombre longueur: length? chiffre1 pos: random longueur cote: random 2 nb1: to-integer to-string pick chiffre1 pos nb2: to-integer random 9 either cote = 1[ resultat: nb1 * nb2 info1/text: rejoin [ nb1 "" " X " "" nb2] show info1][ resultat: nb2 * nb1 info1/text: rejoin [nb2 "" " X " "" nb1 ] show info1 ] focus nombre ;##################################################################### ]] below across indent 60 pad 0x10 label_resultat: label 280x50 "" font-size 22 center indent 15 info2: info 100x50 "" font-size 32 center ] ;##################################################################### fen/offset: 330x165 fen_case/offset: 240x150 view center-face fen