
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 TextMorphForEditView, 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
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 TextMorphForEditView. It has all the methods of the object Text.

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, "write" many "blanks" until the scrollbar to move.
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 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.

IMPORTANT: There are a bug here and you can't use "mouseDown". Use: "mouseStillDown". The user will be not so fast clicking...
If you have the Squeakland plugin you can play with this demo using ListBox:
PREVIOUS LESSON NEXT LESSON T. CONTENTS HOMEPAGE
