• No results found

With a but ton on the menu slide, your stu dents can choose to take the quiz whenever they want. Sometimes this is appropriate; sometimes it is not. For those times when you want your stu dents to complete the tu torial be fore taking the quiz, we will combine variables (to keep track of what the stu dents have done) with hid - ing and showing ob jects (see “Hiding and Showing PowerPoint Objects” in Chapter 6). We will hide the Quiz but ton on the menu slide un til all sections of our tu torial have been visited. Use the code in Figure 7.7 (page 114) to do this. Lines and proce- dures noted with the com ment‘ADDED have been added to the code from the pre vi- ous ex am ple.

Note that this figure does not in clude the RightAnswer,WrongAnswer,

DoingWell, and DoingPoorly pro cedures. Ei ther use the simple ones from the previous ex ample (see Figure 7.6, page 111) or use more com plicated quiz- zes from other examples in this chapter.

If you are add ing onto the pre vious ex ample, all you need to change is the VBA; all the but tons are tied to the same pro cedures. If you are starting with a new file, use Figure 7.5 (page 110) to guide you in creating the PowerPoint slides and tying the buttons to procedures.

The variablesvisitedPart1,visitedPart2, and visitedPart3 are the keys to this ex ample. They tell us whether the student has completed each part of the tu torial. They are set to False in the Ini tial izepro ce dure be cause no part of the tu torial has been completed. They are set to True in the

ReturnToMenuFromPart pro cedures to in dicate when each part of the tu torial has been completed.

Finally, three new procedures have been added: HideQuizButton,

ShowQuizButton, and DoWeShowQuizButton. In my example, the Quiz but - ton is shape number 5 on the menu slide (slide num ber 2) so I can hide it in

HideQuizButton with

ActivePresentation.Slides(2).Shapes(5).Vis i ble = False

ChangeFalse to True to show it, and change 5 to some other num ber if your Quiz but ton is not shape 5. Also note that the Quiz but ton should be hid den at the be gin ning soHideQuizButton is added to Ini tial ize.

DoWeShowQuizButtonasks a three-part question: Is part 1 of the tu torial completed, is part 2 of the tu torial com pleted, and is part 3 of the tu torial com pleted? If all three parts have been completed—(visitedPart1, visitedPart2, and

visitedPart3 have each been set to True)—then we show the Quiz but ton. If any part has not been com pleted (any visitedPart is not True), then we hide the Quiz but ton.

If your tutorial has more parts, you will need to do the following:

• Add more variables, such as visitedPart4 and visitdPart5, and declare them with Dim state ments.

• Initialize the added vari ables in the Ini tial izepro ce dure, with lines like visitedPart4 = False.

• Add more pro cedures (such as ReturnToMenuFromPart4 and

ReturnToMenuFromPart5) to re turn to the menu from the added parts of the tutorial. Be sure to tie the menu buttons to those parts of the tu torial. • Add more parts to theIf ques tion in DoWeShowQuizButton. For

ex am ple:

If visitedPart1 = True And visitedPart2 = True _ And visitedPart3 = True And visitedPart4 = True _ And visitedPart5 = True Then

• Add more smiling sun shine pic tures next to the ad ditional menu but- tons. Hide them in theIni tial ize pro cedure and show them in the ad di tionalReturnToMenuFromPartpro ce dures.

Of course, this same structure does not need to be used for a tu torial and quiz; it could be used for any thing with several parts. If you want your stu dents to complete certain parts before completing some other parts, you can use ex - actly the same code.

Con clu sion

You now have seen several ex amples of ways to create tu torials and quiz- zes. You can create dif ferent kinds of questions and keep and re port scores in different ways. In the next chapter, you learn a few more scripting tricks and get some more ex planation about some pro gramming structures.

Ex er cises to Try

Ä

In the section “Try Again and Again: Answer Again Af ter It’s Right,” we cre ated a sim ple multiple-choice quiz that only counts the student’s first try on each question. Try to add two more mul tiple-choice ques tions to the quiz. Re member that you will need ad ditional vari ablesq3answered and q4answered as well as RightAnswer3,WrongAnswer3,RightAnswer4, and

WrongAnswer4pro ce dures.

Ä

In the section “Short-Answer Quiz Questions,” we added short-answer questions to our multiple-choice quiz. Try add ing two more short-answer questions to your quiz. Re member that you will need additional Ques tion, RightAnswer, and

WrongAnswerpro ce dures.

Ä

In the section “How Did You Do: Reporting Results to the Teacher,” we cre ated a slide with the re sults that was ready to be printed. Fol low the di rections in that section to add two addi- tional ques tions to your quiz. One should be a mul tiple-choice question, and the other should be a short-answer question.

Ä

In the section “Learn First, Ask Questions Later: The Tu torial and Quiz,” you created a simple tu torial and quiz with the shapes hidden and shown—to indicate which sections of the tu torial were completed—and a Quiz but ton that is hid den un til all sec- tions of the tu torial are fin ished. Add a fourth section to your tu- torial and use one of the more com plex quiz structures (at least something that keeps score) for your quiz.

8

More Tricks for Your