


This is a description of what I go through with the students to get
across the concepts of exposure and selection.

This sequence will only be guaranteed to work on a freshly cold-booted
machine.  However, I will make it work from any state as much as
possible.

Be in Lisp Listener 1.  There should be no other Lisp Listeners.

**********************************************************************




When I tell you, click the right hand button of the mouse twice in a
row.  It should sound like this: "Clickclick", not "Click click".  OK,
go ahead.

The menu that appears is called the "System Menu".  It enables you to do
various operations on windows in general, on the current ("This")
window, and enables you to switch back and forth between programs - much
like the SELECT key.

Notice that the Mouse Documentation Line changes as you move the mouse
over different items in the menu.  Where the documentation doesn't tell
you what button to press, use the left one (once).  I might also add
here that clicking a button twice is the same as holding down the
control key and clicking once.

Just for the fun of it, click on the "Attributes" item.  This will pop
up a new menu, with some of the properties of this window displayed.
Make the window go into reverse video, by clicking on the "Yes" next to
"Reverse video".  Then click on "Done".  The window then reverses video.
This only affects the one window.  Other windows are not affected.  Now
switch it back.

Bring up the system menu again (by clicking right twice).  This time
click on "Edit Screen".  This brings up the Screen Editor menu, that
allows you to change the size and position of the windows on the screen.

Notice that this menu does not disappear when you move the mouse out of
the menu.  (The system menu does disappear.)  You must explicitly click
on "Exit" to get out, when you're done editing the screen.

Click on "Create" to create a new window.  It asks you what kind of
window to create, and we'll say "Lisp".  Now the shape of the mouse
cursor changes and you're now choosing the position of the upper left
corner of the window.  Note what the mouse documentation line says.  The
left button will just put the corner exactly where the mouse is; the
middle button will abort out of this, and won't create any window; and
the right button will attempt to line up the new corner with a nearby
edge or corner.  Use the right button when you want to align two
windows, and don't want to watch the mouse carefully.

Ok, make a window about four inches wide and two inches high.  This
should bring the "Edit Screen" menu up again.  Make another window, the
same size, in a position so that the two little windows do not overlap
at all.  Click on "Exit".

Now you should see a big window, Lisp Listener 1; and two small windows,
Lisp Listeners 2 and 3.  Notice that there is only one window with a
blinking cursor.  This window is the @I(selected) window.  That means
that the keyboard is logically connected to that window.  Try it out.
Type in a form, (+ 2 3) for example.  You can use the @k(SELECT) key to
rotate through the Lisp Listener windows, selecting each one in turn.  

A window must be fully @i(exposed) before it is selected, that's why the
small windows get @i(buried) when the big one gets selected.  

Now get back to the situation with the three lisp windows visible.
Another way of selecting a window is clicking left on it.  Do that to
select Lisp Listener 2.

Type the following form: (setq ll2 terminal-io)

This makes the ward of ll2 be the ward of terminal-io.  This gives us a
way to access Lisp Listener 2.  Type the form: ll2<CR> to see what its
ward really is.

Now select Lisp Listener 3 by clicking left on that window.  Type in
this form:  (send ll2 ':draw-line 10 10 100 100)

This draws a line on ll2.  Notice that the window need not be selected
to perform output.  Let's try another experiment.  Type in this form to
erase the line from ll2: (send ll2 ':clear-screen)

Click right twice.  Click on "Edit Screen" and then on "Move Window".
The mouse cursor will turn into a little target.  Move it onto Lisp
Listener 3 and click left.  Now you can move the whole window around.
Move it so that a corner overlaps Lisp Listener 2.  Click left to put it
there.  Click on "Exit".

Now type Control-C followed by Meta-C.  This should bring up the
:draw-line form you typed earlier.  Press the <END> key to do it.  What
happens?

Lisp Listener 3 cannot finish what it is doing until the (send ll2 ...)
form returns.  Output cannot be done on a window until it is completely
exposed.  Therefore Lisp Listener 3 is waiting for ll2 to become
exposed.  You can (when I say) expose ll2 by clicking left on it.
However, suppose that instead of ll2, we had been sending the message to
a window that was completely buried?  How could we click on it?  We can
expose the window that the current process is waiting for by typing
@K(FUNCTION) @K(TRIANGLE).  This brings up the buried window.  Try that
now.

In this case, bringing up the buried window also selects it - since we'd
always like to have a selected window (we'd always like to have the
keyboard logically connected), and the previously selected window can no
longer be selected since it is obscured.

Here's a question for you: How come this doesn't put us in Output Hold
state, since the other Lisp Listener window still is trying to print out
"NIL"?


OK, now let's try some input.  The function @L(TV:MAKE-WINDOW) is what
we use to make a window.  Windows are instances of flavors, but
TV:MAKE-WINDOW does some additional bookeeping.  It takes at least one
argument, which is the name of a flavor, and additional init options to
that flavor.  Type in this form: (SETQ W (TV:MAKE-WINDOW 'TV:WINDOW
':EDGES-FROM ':MOUSE)).  Specify the corners with the mouse.  Don't let
it overlap the little Lisp Listener windows.

Now type in (SEND W ':EXPOSE).  This exposes the window.  Now type:
(SEND W ':TYI).  The :tyi message means read a single character from
this @i(stream).  All windows normally have the stream flavor mixed into
them.

Now type a single "h". (ONE keystroke!)  What happens? Nothing! Type
"ello" (four more keystrokes) Why does nothing happen?

The window W is not selected.  Keyboard input does not go to it.  Now
click left on the plain window to select it.  The blinker in that window
will start blinking to indicate that it is now selected.  Now type a
"g".  What happens? Why?  Now type in "oodbye".  Oh yeah, we need to
select the Lisp Listener window.  So click on that one and type in (send
w ':tyi)  Oops, why did THAT happen?

OK, type <abort>.  This will bring you back to Lisp Top Level.  Now type
(send w ':tyi).  Notice that we didn't have to wait, since there was
already a character typed in.  (How did it get there?)


Notice further that the characters that we typed to the plain window
didn't appear in the window (get echoed, for you knowledgeable types).
This is because there is nothing doing the echoing.  In the Lisp
Listener windows READ is doing it, in editor windows, it's the editor
(but not all characters in the editor get echoed!).  To get simple,
uninterpreted, typein behavior we can do this:

(loop do (send w ':tyo (send w ':tyi)))

Don't forget to select W first!  And where did that "odbye" come from
anyway?

**********************************************************************

Take a break.  Next look at windles.l.