<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7651.59">
<TITLE>Editor Canvas as Output Port</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>The following short piece of code creates an output port to write text onto an editor canvas. The attached file has a short example. It works, but I'm not sure it's an adequate implementation for general usage. For one thing, it only works for text, while, for example, DrScheme lets me write graphic elements (e.g., an image snip) using print (or printf even). Am I correct in that I need to supply an optional-write-special-proc to handle these? It's hard to tell from the documentation I've look at so far.<BR>
<BR>
(define (make-editor-canvas-port editor-canvas)<BR>
(let ((text (send editor-canvas get-editor)))<BR>
(if text<BR>
(make-output-port<BR>
'canvas-port<BR>
always-evt<BR>
(lambda (s start end non-block? breakable?)<BR>
(send text insert<BR>
(bytes->string/latin-1 s #f start end))<BR>
(- end start))<BR>
void)<BR>
#f)))<BR>
<BR>
Is there a similar set of procedures that already exist somewhere I can use?<BR>
<BR>
There seem to be similar things in the Application Framework, but I've only skimmed over them so far. They seem to be overkill for simple MrEd applications, but that may well be a learning curve issue more than anything.<BR>
<BR>
Thanks,<BR>
Doug<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>