Humanities Home page   Office of Digital Humanities
Back     BYU LiveCode Lessons Gateway

DigHT 210

Handler Placement Assignment

One of the most important skills for the LiveCode developer is know how to use the message hierarchy to their advantage. For this assignment you will create a simple "quiz" stack that looks something like this (remember LiveCode best practices):

Instructions:

The top field is "question". It can be any question you like.

The images illustrate the answers. The buttons have labels that show the answer corresponding to the image. The name of the buttons can be whatever you like.

The bottom field is field "feedback". This is where a message goes indicating "correct" or "incorrect" answer.

The following handler will judge whether the question was answered correctly or incorrectly:

  on mouseUp
    if the label of the target = "tree" then -- i.e., the label of the correct answer
	  put "That's right!" into field "feedback"
	else
	  put "Sorry, try again. " into field "feedback"
	end if
  end mouseUp
  

Your task will be to place the handler in the a script at the most efficient level you can think of--be it in buttons, card, group, stack, or whatever. (There may be more than one way to do this.) A good rule of thumb is "Place a handler as far up the message hierarchy as it needs to be, but no farther."

This assignment is due by the beginning of class on the due date specified in the class schedule. Turn in your completed assignment by dragging a copy of the stack from your data disk into the Assignment Drop folder in the DigHT 210 folder on the DigHT 210 server (hummac.byu.edu) as explained before.


Back     BYU LiveCode Lessons Gateway
Maintained by Devin Asay.
Copyright © 2005 Brigham Young University