Hi Steve.

This is not at all a naive question. This is partly showned in the advance
part of spec, and as it said: "ListModel can show more than just text, it
can also visualize any kind of widget."

Here is how you could do a static list of checkBox:
 In your initializeWidget method, create your checkbox:

item1 := self newCheckBox label: 'label1'; help: 'help1'; yourself.
item2 := self newCheckBox label: 'label2; help: 'help2'; yourself.
item3 := self newCheckBox label: 'label3'; help: 'help3'; yourself.

You can then create and display your list:

projectList := (self instantiate: ListPresenter)
displayBlock: [ :x | x buildWithSpec ];
items: {item1 . item2 . item3};
yourself.


And your defaultSpec can be as simple as:

defaultSpec [
^ SpecLayout composed
add: #projectList;
yourself
]

Hope this helps.
Renaud


Le sam. 24 août 2019 à 14:53, Steve Quezadas <steve...@gmail.com> a écrit :

> Guys,
>
> I am learning this new "spec" thing. I created a simple Spec "list" object
> with the following code:
> arbitraryList := ListPresenter new.
> arbitraryList
>    items: #('one' 'two' 'three' 'four. . .');
>    title: 'Arbitrary list'.
> arbitraryList openWithSpec.
>
> Which creates a simple list like follows:
> https://steverstuff.s3.amazonaws.com/arbitrary_list.png
>
> Is there any way to make a SpecPresenter object with an arbitrary list of
> checkboxes? Kind of like a check-off list?
>
> What is the best way of doing this? Should I put checkbox objects in the
> "items:" selector? Or is there another way to do it?
>
> Please forgive the naive question.
>

Reply via email to