Turing: |
import GUI
%Declaration section
var lesson : int
var mainMenuButton : int
var mainMenuWin, introWin, userInputWin, displayWin : int := 0
var lessonButton : array 1 .. 10 of int
forward proc mainMenu
%Title
proc title
cls
locate (1, maxcol div 2 - 5)
put "Music Theory"
end title
proc redirection1
GUI.CloseWindow (introWin )
mainMenu
end redirection1
proc redirection2
Window.Close (displayWin )
mainMenu
end redirection2
proc redirection3
Window.Close (userInputWin )
mainMenu
end redirection3
%Display
proc display
Window.Hide (mainMenuWin )
displayWin := Window.Open ("position:center;center")
title
if GUI.GetEventWidgetID = lessonButton (1) then
put "you pressed 1"
elsif GUI.GetEventWidgetID = lessonButton (2) then
put "you pressed 2"
elsif GUI.GetEventWidgetID = lessonButton (3) then
put "you pressed 3"
elsif GUI.GetEventWidgetID = lessonButton (4) then
put "you pressed 4"
elsif GUI.GetEventWidgetID = lessonButton (5) then
put "you pressed 5"
elsif GUI.GetEventWidgetID = lessonButton (6) then
put "you pressed 6"
elsif GUI.GetEventWidgetID = lessonButton (7) then
put "you pressed 7"
elsif GUI.GetEventWidgetID = lessonButton (8) then
put "you pressed 8"
elsif GUI.GetEventWidgetID = lessonButton (9) then
put "you pressed 9"
else
put "you pressed 10"
end if
put "prepare to be bored beyond death"
mainMenuButton := GUI.CreateButton (400, 100, 0, "Main Menu", redirection2 )
end display
%User Input
proc userInput
Window.Hide (mainMenuWin )
userInputWin := Window.Open ("position:center;center")
title
put "Make your own quiz"
mainMenuButton := GUI.CreateButton (400, 100, 0, "Main Menu", redirection3 )
end userInput
%Main Menu
body proc mainMenu
var lessonName : array 1 .. 10 of string := init ("Music Notation", "Time Values", "Semitones, Whole Tones and Accidentals",
"Major Scales", "Intervals", "Minor Scales", "Simple Time", "Chords", "Finding the Key of a Melody", "Transposition at the Octave")
GUI.Hide (mainMenuButton )
mainMenuWin := Window.Open ("position:center;center")
title
for x : 1 .. 10
lessonButton (x ) := GUI.CreateButton (100, 350 - x * 25 + 25, 300, "Lesson " + intstr (x ) + ": " + lessonName (x ) + "", display )
end for
var quizButton : int := GUI.CreateButton (0, 0, 0, "QUIZ!!", userInput )
var quitButton : int := GUI.CreateButton (550, 0, 0, "Quit", GUI.Quit)
end mainMenu
%Introduction
proc intro
introWin := Window.Open ("position:center;center")
title
put "This program will test you on music theory."
mainMenuButton := GUI.CreateButton (400, 100, 0, "Continue", redirection1 )
end intro
%Good Bye
proc goodBye
var reply : string (1)
var goodByeWin : int := Window.Open ("position:center;center")
title
put "Bye."
put "Press any key to exit"
getch (reply )
Window.Close (mainMenuWin )
Window.Close (goodByeWin )
end goodBye
intro
loop
exit when GUI.ProcessEvent
end loop
goodBye
|
When i go to the main menu after the introduction, it keeps opening a side window? is this a glitch or is there a way to prevent this? |