[comp.sys.m6809] Window Select Bug FIXED!

knudsen@ihwpt.UUCP (05/11/87)

The now-infamous "window select" bug (page 9-40 of the Manual,
BASIC09 section) has been isolated.  The vaccine consists of
fixing a few typos (more like thinkos) in the example
B9 program on page 9-40.  In other words, OS9 Level 2
is OK, but the example is so buggy you couldn't make it work.

The manual states correctly that a window, once Selected by
that escape code, becomes your process"s interactive window,
including keyboard input.

So, the first thing to fix is the OPEN call to the new
window.  The WRITE option should be changed to UPDATE mode
for both read and write.  Makes sense, tho a little confusing
if you are used to thinking in terms of disk files, like me.
As it was, the OPEN failed to permit reading the keyboard,
so the GET call near the end, used to signal the program
to restore the old window, never got your keypresses.
(Funny, I thought I had verified that it was being received,
but then who keeps written notes?)

Second fix is that GET (or INPUT?) call -- it uses #1, but of course you
need #path, so it will read from the new window, not the old.
Do keep the second GFX2("SELECT") call to #1, since it must
go to the original window.

Third fix is to put the CLOSE #path statement last.
I don't know if this is really needed, but I had already tried it
to avoid having the program momentarily in a state with
no active path.

After trying the above, the example works perfectly!
I got this fix from JERRYCG on Delphi, who got it from Steve
somebody (let's test your memory when YOU pass 40).
Ironically, if the example had omitted the GET or INPUT
call (whose only purpose is to wait for you), the example
would have worked.  Well maybe.  Anyway, always open
interactive windows with UPDATE.  JERRYCG says UPDATE is the
default option if you omit it entirely.

PS: How much more of the manual is seeded with land mines
like this?  Oh well, keeps us on our toes...
-- 
Mike J Knudsen    ...ihnp4!ihwpt!knudsen  Bell Labs(AT&T)
    Delphi: RAGTIMER    CIS: <memory failure, too many digits>
		"Just say NO to MS-DOS!"