[racket] GUI: text field on a canvas

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri Jul 18 03:48:15 EDT 2014

On Friday, July 18, 2014, Dmitry Pavlov <dpavlov at ipa.nw.ru> wrote:

> Matthew,
>
> > To get rid of the 5 pixels, you want to set the "inset", not the
> > "margin". See `vertical-inset` and `horizontal-inset` in
> `editor-canvas%`.
>
> Thanks, it worked!
>
> Robby,
>
> >> You can put the text% object directly into the editor-canvas if you
> want.
>
> Err, how do I do that? I just tried
>
> (require racket/gui)
> (define frame (new frame% (label "Test")))
> (define pasteboard (new pasteboard%))
> (define editor-canvas
>   (new editor-canvas%
>        (editor pasteboard)


Use [editor t] on the line just above here (and move the definition of t
up).

And sorry for getting the margin and inset mixed up!

Robby


>        (parent frame)
>        (style '(no-border no-hscroll no-vscroll))))
> (define t (new text%))
> (send pasteboard insert t 0 0)
> (send frame resize 100 100)
> (send frame show #t)
>
> and got
>
> insert in pasteboard%: bad argument combination: (object:text% ...) 0 0
>
>
> Best regards,
>
> Dmitry
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140718/1f86ddd9/attachment-0001.html>

Posted on the users mailing list.