building a GUI rectangle builder: I have a little bug.
24 views
Skip to first unread message
KOKOU AFIDEGNON
unread,
Nov 23, 2020, 4:44:17 AM11/23/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Racket Users
I can click to drag in order to draw a rectangle, but when i drag the created rectangle (for position adjustment), a new rectangle is created from the said position. How do i constrain/fix the issue? i have been trying to use key-combination to draw a new rectangle on demand. can you please give a hint? ``` #lang racket (require racket/gui racket/draw pict)
(define rectangle-snip% (class snip% (init-field w h) (super-new) (send this set-snipclass my-snip-class) (define/override (get-extent dc x y width height . other) (when width (set-box! width w)) (when height (set-box! height h))) (define/override (draw dc x y . other) (draw-pict (rectangle w h) dc x y))))