I am trying to create an interactive presentation to teach spelling. A picture is given, and students click the colored triangles to navigate between choices to complete the word. This slide is named Question1
, and the box whose text should change is named Variable1
. As the students press the triangles, the text will change between hard-coded strings. In this example, the answer is church and the choices are “th”, “wh”, “ph”, “ch” and “sh”.
When the green triangle is pressed, Question1Plus
is called via the Interactions feature. It increments the index by one then calls Question1UpdateDisplay
which will update the text. Question1Minus
does the opposite while also calling the updater. Both functions are designed to wrap around if the index were to go out of bounds. However when I press F5 and enter presentation mode, nothing happens even when I spam both buttons. What is wrong with my code?
The following code is in question.odp > Standard > Module1
. No other code exists anywhere and no other shapes are interactable.
REM *** Initializer ***
Sub Question1Init
oDoc = ThisComponent
oSlideList = oDoc.getDrawPages()
oSlide = oSlideList.getByName("Question1")
oItem = oSlide.getByName("Variable1")
REM *** Defines the array ***
Dim choices()
choices = Array("th", "wh", "ph", "ch", "sh")
REM *** Saves the boundary indices as constants ***
Dim choicesLow, choicesHigh As Integer
choicesLow = LBound(choices())
choicesHigh = UBound(choices())
REM *** Defines the index to be manipulated and initializes it to the first index ***
Dim choicesIndex As Integer
choicesIndex = choicesLow
End Sub
REM *** This function will update the displayed text ***
Sub Question1UpdateDisplay
oItem.getText().setString(choices(choicesIndex))
End Sub
REM *** This function is executed when pressing the up button ***
Sub Question1Plus
REM *** Increase index ***
choicesIndex = choicesIndex + 1
REM *** Wrap around if out of bounds ***
If choicesIndex > choicesHigh Then choicesIndex = choicesLow
REM *** Calls the update function ***
Call Question1UpdateDisplay()
End Sub
REM *** This function is executed when pressing the down button ***
Sub Question1Minus
REM *** Decrease index ***
choicesIndex = choicesIndex - 1
REM *** Wrap around if out of bounds ***
If choicesIndex < choicesLow Then choicesIndex = choicesHigh
REM *** Calls the update function ***
Call Question1UpdateDisplay()
End Sub