<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>Robby means something like this:</div><div><br></div><div><div>#lang racket/gui</div><div><br></div><div>(define f (new frame% [label "Notes"] [width 400] [height 600]))</div><div>(define my-canvas%</div><div> (class canvas%</div><div> (super-new)</div><div> (define/override (on-char . x)</div><div> (displayln x)</div><div> (define dc (send this get-dc))</div><div> (send dc set-scale 1 1)</div><div> (send dc set-text-foreground "blue")</div><div> (send dc draw-text "Use this window for notes" 10 10))))</div><div>(define c (new my-canvas% [parent f]))</div><div>(define t (new text%))</div><div>(send f show #t)</div><div> </div><div>(define mb (new menu-bar% [parent f]))</div><div>(define m-edit (new menu% [label "Edit"] [parent mb]))</div><div>(define m-font (new menu% [label "Font"] [parent mb]))</div><div>(append-editor-operation-menu-items m-edit #f)</div><div>(append-editor-font-menu-items m-font)</div><div><br></div></div><div><br></div><br><div><div>On Sep 20, 2013, at 9:54 PM, Robby Findler wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">A dc<%> object doesn't work like that. If you want to draw something into it, you have to set up a callback and draw during the dynamic extent of the callback. Also, if you do that, you probably want to use a canvas% object, not an editor-canvas%. The editor-canvas% objects already do a lot of work to control what gets drawn in there based on what is in the text% object.<div>
<br></div><div>Robby</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Sep 20, 2013 at 8:40 PM, Alan Johnsey <span dir="ltr"><<a href="mailto:a.johnsey@cox.net" target="_blank">a.johnsey@cox.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="blue" style="word-wrap:break-word">
<div><p class="MsoNormal"><font color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial;color:navy">Thanks. That will do for now, but it
remains a mystery to me why my approach doesn’t work.<u></u><u></u></span></font></p><p class="MsoNormal"><font color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial;color:navy">-Alan<u></u><u></u></span></font></p><p class="MsoNormal"><font color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial;color:navy"><u></u> <u></u></span></font></p><p class="MsoNormal"><font color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial;color:navy"><u></u> <u></u></span></font></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">
<hr size="2" width="100%" align="center">
</span></font></div><p class="MsoNormal"><b><font face="Tahoma"><span style="font-size:10.0pt;font-family:Tahoma;font-weight:bold">From:</span></font></b><font face="Tahoma"><span style="font-size:10.0pt;font-family:Tahoma"> Matthias
Felleisen [mailto:<a href="mailto:matthias@ccs.neu.edu" target="_blank">matthias@ccs.neu.edu</a>] <br>
<b><span style="font-weight:bold">Sent:</span></b> Friday, September 20, 2013
10:17 AM<br>
<b><span style="font-weight:bold">To:</span></b> Alan Johnsey<br>
<b><span style="font-weight:bold">Cc:</span></b> 'Racket Mailing List'<br>
<b><span style="font-weight:bold">Subject:</span></b> Re: [racket] Using GUI
editor</span></font><u></u><u></u></p>
</div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<div><div class="im">
<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">On Sep 20, 2013, at 1:05 PM, Alan Johnsey wrote:<u></u><u></u></span></font></p>
</div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><br>
<br>
<u></u><u></u></span></font></p>
</div><div class="im"><span style="text-align:-webkit-auto;word-spacing:0px">
<div link="blue" vlink="purple">
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">It looks like I’ve stumbled into another area where I’m
lacking a basic understanding of what’s going on. I’m trying to use the
built-in editor in the gui package, but I need to put some initial content into
the editor window. When I put the following in the editor pane and run it, I
get the gui editor, but not the text. When I then<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">simply put the last line into the interactions window and
execute it, I get the text in the gui editor window as desired. Why? What do I
need to do to programmatically modify the text in the gui window?<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">-Alan<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial"><u></u> <u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">#lang racket/gui<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">(define f (new frame% [label "Notes"]<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">
[width 400]<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">
[height 600]))<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">(define c (new editor-canvas% [parent f]))<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">(define t (new text%))<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">(send c set-editor t)<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">(send f show #t)<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial"><u></u> <u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">(define mb (new menu-bar% [parent f]))<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">(define m-edit (new menu% [label "Edit"] [parent
mb]))<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">(define m-font (new menu% [label "Font"] [parent
mb]))<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">(append-editor-operation-menu-items m-edit #f)<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">(append-editor-font-menu-items m-font)<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial"><u></u> <u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">; above pretty much straight out of the Design Doc</span></font><u></u><u></u></p>
</div>
</div>
</span>
<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
</div>
<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
</div>
</div><div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Do you want this<u></u><u></u></span></font></p>
</div><div class="im">
<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
</div>
<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> (send t insert "Use this window for making notes" 10
10)<u></u><u></u></span></font></p>
</div>
<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
</div>
<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">instead of the below? <u></u><u></u></span></font></p>
</div>
<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
</div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><br>
<br>
<u></u><u></u></span></font></p>
</div><span style="text-align:-webkit-auto;word-spacing:0px"><u></u><u></u><u></u>
<div link="blue" vlink="purple">
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial"> <u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">(define dc (send c get-dc))<u></u><u></u></span></font><u></u><u></u></p>
</div><div class="im">
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">(send dc set-scale 1 1)<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">(send dc set-text-foreground "blue")<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial">(send dc draw-text "Use this window for making
notes" 0 0)<u></u><u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial"><u></u> <u></u></span></font><u></u><u></u></p>
</div>
<div><p class="MsoNormal"><font face="Arial"><span style="font-size:10.0pt;font-family:Arial"><u></u> <u></u></span></font><u></u><u></u></p>
</div>
</div><p class="MsoNormal"><font size="4" face="Lucida Grande"><span style="font-size:13.5pt;font-family:"Lucida Grande"">____________________</span></font></p><div class="im"><font size="4" face="Lucida Grande"><br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><u></u><u></u></font></div><div><br class="webkit-block-placeholder"></div>
</div>
</span></div><p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"></span><u></u> <u></u></font></p>
</div>
</div>
<br>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></body></html>