Here's a handy function that you can use when you need to display messages for debugging purposes. Just drop it into your program, then whenever you want to display a debugging message, just call FN TestMessage and pass it the string you want to display. The message window will build itself the first time the function is called--no initialization necessary. Since it uses an edit field, you can even scroll up (by dragging through the field) to see previous messages.
'-----------LOCAL MODE
LOCAL FN TestMessage(msg$)
_testWnd = 255
DIM oldOutput&, x1, y1, x2, y2, oldActive, wndWidth, wndHeight
DIM needToCut, teH&
wndWidth = 250: wndHeight = 100 'Change as desired
CALL GETPORT(oldOutput&)
LONG IF WINDOW(-_testWnd) = 0
x2 = SYSTEM(_scrnWidth)-10: y2 = SYSTEM(_scrnHeight)-10
x1 = x2 - wndWidth: y1 = y2 - wndHeight
oldActive = WINDOW(_activeWnd)
WINDOW _testWnd, "Testing", (x1,y1)-(x2,y2), _docnogrow
TEXT _monaco, 9
EDIT FIELD -1, "", (0,0)-(wndWidth, wndHeight), _noframed
IF oldActive <> 0 THEN WINDOW(oldActive)
END IF
WINDOW OUTPUT _testWnd
msg$ = msg$ + CHR$(13)
'If this msg$ will exceed the field's capacity,
'cut some lines from the top:
teH& = TEHANDLE(1)
needToCut = teH&..teLength% + LEN(msg$) - 32767
LONG IF needToCut > 0
SETSELECT 0, needToCut
CALL TEDELETE(teH&)
END IF
SETSELECT 32767,32767
TEKEY$ = msg$
CALL SETPORT(oldOutput&)
END FN
'--------