#lang racket/gui

(define f (new frame% [label "List Editor"]))

(define items (new vertical-pane% (parent f)))

(define (create-item val parent)
  (define v (new vertical-panel% (parent parent)))
  (define ins (new button% (parent v) (label "insert")
                   (callback (λ (b e) (create-item "" items))) ))
  (define h (new horizontal-pane% (parent v)))
  (define t (new text-field% (parent h) (label "") (init-value val)))
  (define del (new button% (parent h) (label "del")
                   (callback (λ (b e) (send parent delete-child v))) ))
  v)
   
(for-each (λ (v) (create-item v items)) '("1" "2" "3"))
   
(new button% (parent f) (label "append") (callback (λ (b e) (create-item "" items))))

(send f show #t)
