approach question: (define (recipe-tab tab-parent conn)
(begin
(define (open-recipe-item ))
(define panel (new horizontal-panel%
[parent tab-parent]))
(define recipe-list (new list-box%
[parent panel]
[label false]
[choices (recipe-list-data conn)]))
(define recipe-item (new vertical-panel%
[parent panel]))
(define title-field (new text-field%
[label "Title"]
[parent recipe-item]
[style (list 'multiple 'vertical-label)]))
(define ingerdiants-field (new text-field%
[label "Ingrediants"]
[parent recipe-item]
[min-height 100]
[style (list 'multiple 'vertical-label)]))
(define directions-field (new text-field%
[label "Directions"]
[parent recipe-item]
[style (list 'multiple 'vertical-label)]
[min-height 200]
[stretchable-height true]))
(define save-btn (new button%
[parent recipe-item]
[label "save"]
[callback (lambda (btn ev)
(insert! conn
(make-recipe #:title "Chicken Burrito"
#:ingrediants ""
#:directions ""))
(send recipe-list set (recipe-list-data conn)))]))
void))
Im inclined to wrap this into a custom object with a similar convention as existing UI objects (new recipe-tab%
[parent parent]
[data ...])
is that the usual way to do things?
I’d say yes.
coolio, thanks :slightly_smiling_face:
It has happened before that I have regretted representing something explicitly (as a struct or an object). Much easier to do it from the beginning.
another quick question… inentities
returns a seq, and the examples then use for/list
where i would expect map
but map does not accept a seq if i understand ?
Good old map
only handles lists.
However, there is a sequence-map
.
yeah, i saw that, but that returns a seq, and the list-box% takes a list :wink:
i think its probably just me and liking certain names for certain things :smile:
I often keep a little section of small one-of utilities at the top. The perfect place to define your own seq-map
that does what you want.
@joshua.e.cottrell has joined the channel