Sub WrongAnswerButton(answerButton As Shape)
Dim thisQuestionNum As Long
thisQuestionNum = _
ActivePresentation.SlideShowWindow.View.Slide.SlideIndex - 1
an
swer(thisQuestionNum) = answerButton.TextFrame.TextRange.Text
WrongAnswer
End Sub
You have al ready seen (in the
RightAnswer
and
WrongAnswer
pro ce dures)
thisQuestionNum
used to store the number of the current question. The only
new
code is the
Dim
state
ment to de
clare
an
swer
as an ar
ray and the
answerButton.TextFrame.TextRange.Text
to
get the text from the but -
ton that was pressed (as described above). In ad dition, we have done a bit of re -
structuring. In the orig inal example in Chapter 7, each
but ton had its own
procedure, and that procedure took care
of storing the answer, keeping track of
which
ques tion was an swered, and keep ing score. We have di vided up that
work. Now the
RightAnswerButton
and
WrongAnswerButton
pro ce dures
take care of storing the answer, and the
RightAnswer
and
WrongAnswer
pro -
cedures take care of keeping track of which question was answered and keeping
score.
This division of labor will be important when
we add a short-answer ques-
tion. For short-answer questions, we are go ing to need a
Do'stlaringiz bilan baham: