Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to make a list render some custom models -- see http://j.mp/1fzQ0HQ
items := (1 to: 5) collect: [ :index || model |
model := DynamicComposableModel new
instantiateModels: #(
nameLabel LabelModel
address LabelModel
button ButtonModel ).
model nameLabel label: 'Name'.
model address label: 'Address'.
model button
label: nil;
icon: Smalltalk ui icons smallCancelIcon.
model layout: (SpecLayout composed
newColumn: [ :c |
c add: #nameLabel height: model class buttonHeight.
c add: #address height: model class buttonHeight.
c newRow: [ :r |
r
newColumn: [ :col | ];
add: #button width: model class buttonWidth ] height: model class buttonHeight]).
model ].
"items first buildWithSpec."
model := ListModel new.
model items: items.
model displayBlock: [ :e | e
extent: 200@100;
yourself ].
model openWithSpec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.