QUIZ USING LIST BOX

In the previous lesson we have used "Radio Buttons" to choose our entry. Now we will use a "List Box". Play with our project:

We know how to put texts in the world. Here, the first new thing is an object called "Scrolling Text" that we need to drag to the world.

It will be the base of our List Box.

Unfortunately we can't put buttons inside the "Scrolling Text". So we will put a Text for each option of answer. But first we need to create many blank lines inside the "Scroling Text" only using the tab key (blanks), until we see the scroll bar moving. When the "Scrolling Text" has many blank lines, we put our first answer (AUSTRIA) in the top of it.

But we need to "embed" this object (a Text) inside the Scrolling Text object. To do it we open the menu of the halo of the Text and choose "embed into Transform Morph". We can test to see if the text "AUSTRIA" moves up when we move down the scrolling bar.

Opening the Viewer of "AUSTRIA" we change the name of the object to Austria and create a new script.

Now, like Austria is a WRONG ANSWER we need to create a new Text having this message. We will open the Viewer of this new Text (not Austria), call it Line1 and, in the script of Austria we will put the lines of the figure:

In the future, when we have the messages for the other options (Line2, Line3 etc.) we will put lines to hide them. The "trick" is more or less like we did in the previous project.

But how we will do this script run when we click in the option?

Clicking in the word: "normal" in the top of the script window we open another menu (the "When should this script run?" Menu).

Unfortunately the options "mouseDown" and "mouseUp" are not working well. So: we choose: "mouseStillDown" and this is the reason we said to "drag over the right answer". Quick clicks don't work...

Hide the message using the viewer or the tab key of the keyboard.

We need to do the same thing for the other options of countries. It's a hard work... But the result is fine! And you will have your quiz using a ListBox. If you have MANY answers or little free space in the page is a better option than RadioButtons to do the entry.


PREVIOUS LESSON NEXT LESSON
T. CONTENTS HOMEPAGE