Thanks, I'm opening another subject meanwhile, Can you please advise?
This is my current code which displays a rectangle on a pasteboard.
I'm trying to build a wireframe designer where. I can click on a button or a node on a rectangle to create either an inner rectangle/circle or another standalone shape which will also contains their properties. At the end, those created object will serve to generate code samples.
Can you please advise what functions or classes needed to improve on that?
Below is the current implementation done so far.
#lang racket
(require racket/gui racket/draw pict)
(define board (new pasteboard%))
(define toplevel (new frame%
[label "My board"]
[width 500]
[height 500]))
(define canvas (new editor-canvas%
[parent toplevel]
[editor board]))
(send toplevel show #t)
(define my-snip-class
(new (class snip-class%
(super-new)
(send this set-classname "my-snip"))))
(send (get-the-snip-class-list) add my-snip-class)
(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))))
(send board insert (new rectangle-snip% [w 30] [h 80]) 100 300)