chris613
2020-1-9 14:38:46

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?


soegaard2
2020-1-9 14:40:48

I’d say yes.


chris613
2020-1-9 14:40:56

coolio, thanks :slightly_smiling_face:


soegaard2
2020-1-9 14:42:02

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.


chris613
2020-1-9 14:43:21

another quick question… inentities returns a seq, and the examples then use for/list where i would expect map


chris613
2020-1-9 14:43:32

but map does not accept a seq if i understand ?


soegaard2
2020-1-9 14:44:35

Good old map only handles lists.


soegaard2
2020-1-9 14:44:45

However, there is a sequence-map.


chris613
2020-1-9 14:45:14

yeah, i saw that, but that returns a seq, and the list-box% takes a list :wink:


chris613
2020-1-9 14:46:08

i think its probably just me and liking certain names for certain things :smile:


soegaard2
2020-1-9 14:47:48

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
2020-1-10 04:09:01

@joshua.e.cottrell has joined the channel