[plt-scheme] MrEd Question

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Dec 6 17:11:02 EST 2005

At Tue, 06 Dec 2005 12:56:12 +0200, Faibish wrote:
> How can i create objects in a window which are dragable but not editable not 
> deletable and not resizable and which the caret is hidden ?

I'm not sure I understand the question, but I think you want objects in
a pasteboard, you don't want the selection to be shown, and you don't
want the keyboard focus to ever go to one of the pasteboard's objects.
An example program is below, in case I'm on the right track.



(define my-pasteboard%
  (class pasteboard%
    (inherit set-selection-visible)
    ;; Override on-double-click so that the focus is
    ;;  never moved to a contained object:
    (define/override (on-double-click s e)
    ;; Don't draw dots around the selected object:
    (set-selection-visible #f)))

;; Try it out:

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

(define pb (make-object my-pasteboard%))

(new editor-canvas%
     [parent f]
     [editor pb])

(send pb insert (make-object image-snip%
                  (build-path (collection-path "icons")
      0 0)

(let ([b (make-object editor-snip%)])
  (send (send b get-editor) insert "boxed")
  (send pb insert b 100 100))

(send f show #t)

Posted on the users mailing list.