Listener Text
TEXTSCREEN CLEARTEXT PRINT TYPE SETTEXTFONT SETTEXTCOLOR
This section shows you how to print text to the Listener panel.
TEXTSCREEN
TS
TEXTSCREEN
makes the Listener panel take over the screen. This command maximizes the Listener panel and minimizes the Graphics and Editor panels.
This is useful if you want to write a program that is just for text, with no graphics.
You can use it programs you write.
Other commands that change the layout are SPLITSCREEN
and FULLSCREEN
. See the section on Organizing the Layout.
» Things to Try
Type TEXTSCREEN
or its abbreviation TS
and see what happens.
Then type SPLITSCREEN
to see how the layout changes.
Type FULLSCREEN
. If you need to get the Listener panel back, you can choose Listener from the Window menu at the top.
CLEARTEXT
CT
CLEARTEXT
erases all the text in the Listener panel and places the blinking text cursor at the upper left.
You can use this command in programs you write.
» Things to Try
Type some text into the Listener panel and then type CLEARTEXT
or its abbreviation CT
.
Tip: If your text cursor is in another panel, you can type Ctrl+L to place it in the Listener panel.
PRINT word-or-list
(PRINT)
(PRINT word-or-list1 word-or-list2 word-or-list3 ...)
PR word-or-list
(PR)
(PR word-or-list1 word-or-list2 word-or-list3 ...)
PRINT
takes an input (one or more words or lists) and displays the text in the Listener panel and adds a line feed to put the text cursor at the beginning of the next line.
If you don’t use any inputs, (PRINT)
creates a blank line.
If you have more than one input, put the entire instruction in parentheses.
PRINT 75
75
PRINT "Hello
HELLO
PRINT "|Hello, my name is Sam.|
Hello, my name is Sam.
(PRINT 2 "+ 2 "is 4)
2 + 2 IS 4
You can also use back ticks (`) to surround text to retain the case of the letters, like this:
PRINT `Hello, my name is Sam.`
Normally, the Listener panel can contain just 100 lines of text.
If you wanted to print out all the lines of a poem that was longer than that (“The Twelve Days of Christmas”, for example), you would not be able to see all of it. Some of the beginning lines wouldn’t be in the Listener panel.
You can fix this to make the number of lines larger in one of two ways:
- Go to Tools > Settings and change the number there. It’s called “Maximum number of Listener lines”.
- Use this command:
PPROP "PREFS "LISTENER.LINES 200
Now the Listener panel can store 200 lines of text. You could use this instruction in a program. Changing the number of lines in the Listener panel using this instruction also changes the number in the Settings area.
» Things to Try
Experiment with PRINT
in the Listener panel.
Write a procedure that uses PRINT
to display different types of text.
TYPE word-or-list
(TYPE)
(TYPE word-or-list1 word-or-list2 word-or-list3 ...)
TYPE
is like PRINT
except that it does not add a line feed at the end of the text to display.
If you give TYPE
multiple inputs, put the entire instruction in parenthese. Logo will not add any spaces between the inputs.
If you don’t give any inputs, place the TYPE
in parentheses. Logo will just add a line feed to move the cursor to the beginning of the next line.
TYPE "GEORGE TYPE "WASHINGTON
GEORGEWASHINGTON>
; the text cursor comes immediately after the >, which starts each line.
(TYPE 1 2 3)
123>
(TYPE)
>
TYPE "|Once upon a time...|
Once upon a time...>
» Things to Try
Try using TYPE
in the Listener panel and in procedures.
TYPE
is particularly handy if you want to ask a user a question and have the place for the user to type be right after the ? mark, like this:
What is your name? ___
You would use READLIST
, like this to get the user’s name. Read more about READLIST
in Getting User Input.
TYPE "|What is your name? |
MAKE "MYNAME READLIST
SETTEXTFONT name size style
(SETTEXTFONT name size)
(SETTEXTFONT name)
(SETTEXTFONT)
Text you print to the Listener panel can be in any font, size, and style you want.
The default text is Monospace font, size 12, plain style.
If you type this instruction:
SETTEXTFONT "ARIAL 14 1
All the current text will change immediately to those settings.
The styles you can use are:
- 0 - plain
- 1 - bold
- 2 - italic
- 3 - bold italic
You can use SETTEXTFONT
with different numbers of inputs to change just some of the settings. If you do this, place the entire instruction in parentheses. To reset the font to its default settings, use (SETTEXTFONT)
.
Note that you can change the default font, size, and style in Logo’s Tools > Settings menu.
The FONTS
reporter tells you the fonts available in your computer. If the font name you specify is not present, the computer will choose one that is similar.
Use TEXTFONT
to find out the name of the current text font.
You can use the SETTEXTFONT
command in programs you write.
» Things to Try
Play around with different font settings in the Listener panel.
What happens if you type a font name that isn’t in your computer’s system?
What is the largest font size you can use?
What is the smallest size you can use?
SETTEXTCOLOR foreground background
(SETTEXTCOLOR foreground)
SETTEXTCOLOR
allows you to set the color of the text in the Listener panel.
You can set the foreground color, the color of the letters, and also the background, the color behind the text. Setting the background color does not change color of the entire Listener panel, just the color behind the characters.
Here are some examples:
If you change the background color, you can reset it to normal by using "WHITE
as the background color.
You can use the SETTEXTCOLOR
command in programs you write.
» Things to Try
Explore displaying text in different colors in the Listener panel.