
Squeak has an object that is an area to be used for publication of big texts: the ScrollingText. We will show here that it can be used also like a ListBox. ListBox is a graphical component from which the user can select choices.
We will present first the object used to present a text inside. In the end of the lesson we will talk about its use like a ListBox.
The ScrollingText object has 2 objects inside it: the Text, where the text is placed, and a ScrollBar.
The object is instatialized graphically dragging it from the "Green window":

position
Drag the Move button of the Halo.
size
Not the size of the letters (that are inside Text objects). Drag the Size button of the Halo.
sendToBack, bringToFront, embedInto
changeColor
Changes the background color
changeText
You need to open the Menu of the object Text. It has all the methods of the object Text (previous lesson) .
makeScrollBarRetractable
makeScrollBarInBoard

scrollBarOnLeft
scrollBarOnRight
show
hide
LISTBOX
To create a ListBox, step by step:
1 - Drag a ScrollText from the "Green window".
2 - Using the TabKey, include many "blanks" until the scrollbar moves.
3 - The "first option line" will be an object Text, dragged from the "Green window". You need - very important! - to select:embed into TransphormMorph

4 - Do the same thing for the other options. Change the text to your options.You can change the font and the background color of each Text.
5 - Change the size of the ScrollingText to see if all is OK. If not, verify your options for "embed into" - the usual error.
6 - Each object Text (the options) can be a button - any object in Squeak can be a button - and you can glue to it an script that will start when the user clicks it. Find the pallete "Scripts" and drag an "Script Editor". Write the code to run when the line (the text) is clicked. Select "normal" and the option.

NOTE OF THE BETA VERSION: Use "mouseUp" because "mouseDown" is not working OK.
If you will do a test of this tricks, remember to do an "accept" after write the code... The usual error...
PREVIOUS LESSON NEXT LESSON T. CONTENTS HOMEPAGE
