[racket] Using GUI editor

From: Alan Johnsey (a.johnsey at cox.net)
Date: Sun Sep 22 19:18:50 EDT 2013

I should have given a better explanation of what I'm trying to accomplish.
I'm trying to create an outline/template for taking notes during the
execution of a program, Most of the contents of the window will come from
the user either by typing directly or by copying and pasting from
information provided by the program, hence the desire to use an
editor-canvas%. Your earlier suggestion to simply use 


(send t insert "Use this window for making notes" 10 10)


to initialize the editor-canvas% works fine for this purpose, but a canvas%
doesn't. I have some notion of later being able to modify the content/format
of such an "Intelligent Notepad" dynamically, but I'm not there yet either
in terms of overall design or of understanding how to use the gui to
accomplish this. Thanks for your help.





From: Matthias Felleisen [mailto:matthias at ccs.neu.edu] 
Sent: Saturday, September 21, 2013 6:40 AM
To: Alan Johnsey
Cc: Racket Mailing List
Subject: Re: [racket] Using GUI editor



Robby means something like this:


#lang racket/gui


(define f (new frame% [label "Notes"] [width 400] [height 600]))

(define my-canvas%

  (class canvas%


    (define/override (on-char . x)

      (displayln x)

      (define dc (send this get-dc))

      (send dc set-scale 1 1)

      (send dc set-text-foreground "blue")

      (send dc draw-text "Use this window for notes" 10 10))))

(define c (new my-canvas% [parent f]))

(define t (new text%))

(send f show #t)


(define mb (new menu-bar% [parent f]))

(define m-edit (new menu% [label "Edit"] [parent mb]))

(define m-font (new menu% [label "Font"] [parent mb]))

(append-editor-operation-menu-items m-edit #f)

(append-editor-font-menu-items m-font)




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130922/a6e6f58c/attachment-0001.html>

Posted on the users mailing list.