So you’ve made devMode in Lectora® and you have a button to turn it on and off, but it doesn’t DO anything… yet. Basically, we made a light fixture and attached a light switch, but there’s no light bulb, so flicking the switch on and off won’t do much. Today, we’re going to add the words devMode on to act as our light bulb.
How to add a devMode indicator
- At the top level of your course, add a textbox.
This textbox is at the same level of your course as your devEntrance button so that the button can refer directly to the textbox. Presumably this is at the top level so that it can be inherited throughout the course.
- In the textbox, enter the words devMode on and style them as you like.
I like to use Arial Black and an orange font color so that the text stands out. You can use whatever words or formatting you like.
- In the Properties ribbon, name the textbox dM indicator and select Initially Hidden as well as Always on Top. Feel free to also add an entrance and exit FADE transition.
Next, we will make the button that turns devMode on and off ALSO turn this textbox ON and OFF.
- Select the devEntrance button and add a second action:
- Trigger: Mouse Click
- Action: show dm Indicator
- In the Conditions column, click Always and add the following condition
Relationship: is equal to
- Click OK.
In English, what we are programming is this… “when the devEntrance button is clicked, show the ‘light bulb’ if devMode is ON. Otherwise, do nothing.”
NOTE: Actions run top to bottom, first to last. It is critical that THIS action run AFTER the action which turns devMode ON. In other words, the show indicator action MUST be below the devMode toggle action in the Title Explorer or else it won’t work. Also, whenever I create a conditional action, I like to add the word IF to the name.
Finally, we will specify what happens if devMode is already ON when you click the button, which is to turn off the indicator.
- In the Else Actions area, add the following action:
- Action: Hide
- Target: dM indicator
Feel free to test this functionality by previewing your course and clicking your hidden devEntrance button. You should now be turning your “light bulb” on and off.
Now go to the next page. DevMode is still on, but your indicator text is NOT. We will now fix this.
- Select the dM indicator textbox and add an action with the following properties:
- Trigger: onPageShow
- Action: Show
- Target: this object
- Conditions: devMode is equal to 1
- Else Actions: None
In plain English: “when you go to a new page, if devMode is on, show this indicator. If not, do nothing.” Now if you travel to a new page, your devMode indicator will remain on. Test this.
Good work, today!
Next time, we are going to give ourselves some superpowers in devMode .
Download the Lectora and Lectora Online files for this course in the Trivantis® Community.
John Mortenson is the Online Learning Manager for The Fresh Market. He has been developing online courses for over 10 years and is a member of the Lectora Advisory Board. He is also an Adobe Creative Suite Guru and cartoonist. You can contact him on LinkedIn and Twitter.