previous chapter contents page top page next chapter


LessonStep

March 15, 1996

inherits from Object;

Class Description

When you create your own lesson, you'll specify the steps that make up the lesson and a step list that refers to all the steps. Magic Cap defines class LessonStep for you to use in specifying instructions, or steps, in your lesson.

Programming information

Instantiate: sometimes
Subclass: rarely
Call its methods: rarely

When you create a lesson, you'll declare an object of class LessonStep for every instruction in the lesson. Each lesson step includes information about the step in its fields. You might create a subclass of LessonStep in rare instances if you want to customize your lesson's behavior by overriding some operations, such as AcceptTouch and PerformTouch.

Methods defined by class LessonStep

Class LessonStep defines the following methods:

Method Description
BeforeAction Called by Magic Cap before window is displayed for this step.
Action Called by Magic Cap after a window is displayed for this step.
AfterAction Called by Magic Cap just before setting up the next step.
TouchTarget Checks for user touches in window.
AcceptTouch Determines whether to advance to next lesson.
PerformTouch Calls touch or tap on accepted target.
TargetMissedFeedback Called by TouchTarget when target is missed.
ShouldSuspend Called after step to hide lesson.
ShouldResume Always returns true; override to sometimes remain suspended.
ShouldAbortSuspended Always returns true; override to sometimes abort suspended lesson.
HandleCantContinue Returns true if step can't succeed in current environment.
BalloonDot Returns spot for balloon tail.
LessonWindow Returns window to use for this step.
Target Overriden to return stepTarget field as target.

Fields defined by class LessonStep

Class LessonStep defines the following fields:

Field Type Description
Defined by class LessonStep
stepFlags Flags Various flags for lesson step, including window type
stepTargetBox Box Used when target is larger than one viewable
stepTarget Viewable Viewable pointed at by this step
stepBalloonDot Dot Spot for balloon tail
stepWIndowDot Dot Origin of lesson window for this step
stepText Text Text in lesson window for this step

Method Descriptions

BeforeAction

operation BeforeAction()
Call: rarely
Override: rarely

Magic Cap calls BeforeAction before the window is displayed for this step. You might override BeforeAction by creating a Magic Script for it in your lesson step.

Action

operation Action()
Call: rarely
Override: rarely

Magic Cap calls Action after the window is displayed for this step and the tool is set to the lesson tool. You might override Action by creating a Magic Script for it in your lesson step.

AfterAction

operation AfterAction()
Call: rarely
Override: rarely

Magic Cap calls AfterAction just before setting up for the next step in the lesson. You might override AfterAction by creating a Magic Script for it in your lesson step.

TouchTarget

operation TouchTarget(target: Viewable; touchInput: TouchInput)
Call: rarely
Override: rarely

Magic Cap calls TouchTarget to see if the user has touched the target. TouchTarget calls AcceptTouch to see if the touch should be accepted. If so, TouchTarget then calls PerformTouch.

AcceptTouch

operation AcceptTouch(target: Viewable; where: Dot; VAR advance: 
Boolean): Boolean
Call: rarely
Override: rarely

Magic Cap calls AcceptTouch to see if the touch should be accepted. AcceptTouch uses the step flags to determine whether the touch should be accepted.

PerformTouch

operation PerformTouch(target: Viewable; touchInput: TouchInput)
Call: rarely
Override: rarely

Magic Cap calls PerformTouch to call Touch or Tap on the accepted target after AcceptTouch has returned true.

TargetMissedFeedback

operation TargetMissedFeedback()
Call: rarely
Override: rarely

Magic Cap calls TargetMissedFeedback from TouchTarget when the user misses the target for this step. TargetMissedFeedback blinks the target or the target box, depending on relevant settings in the step flags.

ShouldSuspend

operation ShouldSuspend(): Boolean
Call: rarely
Override: rarely

Magic Cap calls ShouldSuspend after the lesson step to hide the lesson until NextStep is called.

ShouldResume

operation ShouldResume(): Boolean
Call: rarely
Override: sometimes

Magic Cap calls ShouldResume to determine if the lesson should resume when NextStep is called. LessonStep_ShouldResume always returns true.

ShouldAbortSuspended

operation ShouldAbortSuspended(): Boolean
Call: rarely
Override: sometimes

Magic Cap calls ShouldAbortSuspended to determine if the suspended lesson should be aborted when AbortSuspendedLesson is called. LessonStep_ShouldAbortSuspended always returns true.

HandleCantContinue

operation HandleCantContinue(): Boolean
Call: rarely
Override: sometimes

Magic Cap calls HandleCantContinue to determine if this lesson step can't continue because of the current environment, such as the target being off screen. LessonStep_HandleCantContinue always returns true.

BalloonDot

operation BalloonDot(VAR balloonDot: Dot): Boolean
Call: rarely
Override: rarely

Magic Cap calls BalloonDot to determine where to place the balloon tail. LessonStep_BalloonDot returns field stepBalloonDot or the target origin, depending on the settings of the relevant step flags.

LessonWindow

attribute LessonWindow: LessonWindow, readOnly
// operation LessonWindow():LessonWindow
Call: rarely
Override: rarely

The attribute LessonWindow refers to the window that will be used to display this lesson step.

Target

overrides Target
Call: rarely
Override: sometimes

Class MagicWindow overrides Target to return the value of field stepTarget for this step's target.