Wednesday, August 10, 2011

Creating a Smart Next Button in Lectora

by Jonathan Shoaf

Reducing the number of objects in your development project saves time to develop and makes project maintenance easier.  Most e-learn development tools provide some sort of object reuse through inheritance or master pages.

While not everyone is a fan of the next button, it is a common object found in e-learning.  Its appearance on many pages makes it a prime candidate for reuse.  In this post we take a look at how to make a next button that can be reused on all pages of a project...even if you want the learner to return to the main menu after each chapter.

We'll look at a course built in Lectora that has a main menu and several chapters.  I put the page with the main menu at the title level in the following format:

Place the next button at the title level for reuse in all pages

The main menu has a link to each chapter and no next button.  Every other page contains the same next button.  I do this by placing the next button on the title level and let all the chapters inherit it.

On the On Click tab the action is set to "Go To" with a target of "Next Page".  Done, right?

Replacing the next button last page of each chapter 

Setting it this way will result in the last page in each chapter going to the first page in the next chapter.  That's not really the functionality I'm looking for.  I want the learner to return to the main menu after each chapter so I can give them some nice updates on their course progress and allow them to choose where to go next.

Ok, simple enough, so I don't inherit the next button and add a custom button to the last page of each chapter.  That button will have an action of "Go To" with a target of "Chapter, Section, or Page" that goes back to the main men page.  Done, right?

That will work, but I now have multiple buttons across my project that will need updating.  Depending on how many chapters you have, this could be a lot of work.  I've also been known to put crazy logic at the title level that disables the next button to the learner (I'm weird that way).  If the logic needs to remain but the button is no longer there to be acted on...Lectora gives me an error message.  Just trust me, yuck!  So scratch this method, there's a better way.

Creating a smart next button.

The better way is a "smart" next button.  The smart next button knows when it is in the last page of the chapter and will automatically go back to the main menu.  I do this by using a condition as follows:
  • Select the Next button and make sure the action on the On Click tab is set to "None".  We'll need an action which contains an Else tab.
  • Add an action to the button (it has an Else'll see why its needed below)
  • Set the action to occur on "Mouse Click"
  • Set the action to "Go To"
  • Set the target to "Next Page"
  • Next, select the Condition tab and check "Perform action ONLY if the following is TRUE:"
  • For the variable use "PageInChapter"
  • For the relationship use "Less Than"
  • For the value type in "VAR(PagesInChapter)"
  • Finally, select the Else tab and check "If the conditions are not met, perform the following action:"
  • Set the action to Go To
  • Set the target to Chapter, Section, or Page
  • Set the name to your main menu page
  • Hit the Apply button (with joyful expectation that it'll all work)

It's alive!  You have created a smart button.  The button will now go to the next page when clicked. When you are on the last page in the chapter, it will return to the main menu.  It does this by comparing PageInChapter to PagesInChapter and acting accordingly.

No comments:

Post a Comment

Thank you for your comments.