Benjamin wrote:
Thanks for the example :) Indeed, the documentation is a bit outdated since Spec is still improving a lot, a changing a bit in its API.One of my goal now is to write proper doc for Spec :) Ben On Oct 11, 2013, at 8:23 AM, b...@openinworld.com wrote:I found it hard to find documentation on Spec beyond [1],[2],[3], some of which seem to have changed some syntax since they were written. I've been piecing things together to work out how to set the selected item with the simplest example I could. Even though it turns out pretty simple, I thought I'd share in case it was useful for others that haven't dipped their toes into Spec yet. ComposableModel subclass: #TestSpec instanceVariableNames: 'list text' classVariableNames: '' poolDictionaries: '' category: 'BTCPlay' TestSpec >> initializeWidgets self instantiateModels: #( #list #ListModel ).this could be changed in: list := self newList. Benjamin, What are the advantages of doing it one way or the other? So do you mean that #instantiateModels: will be deprecated? cheers -ben TestSpec >> getList ^list TestSpec class >> mySpecLayout <spec:#default> ^ SpecLayout composed add:#getList ; yourself. Then from Workspace x := (TestSpec new openWithSpec ; yourself). x getList items: { 1 . 2 . 3 . 4}. x getList setSelectedItem: 2. cheers -ben [1] hal.inria.fr/hal-00759030/PDF/Spec-IWST12-Final.pdf [2] https://ci.inria.fr/pharo-contribution/job/PharoForTheEnterprise/lastSuccessfulBuild/artifact/Spec/Spec.pier.pdf [3] http://hal.inria.fr/docs/00/70/80/67/PDF/SpecTechReport.pdf |
- Re: [Pharo-users] Simple Spec Exam... Johan Fabry
- Re: [Pharo-users] Simple Spec Exam... Stéphane Ducasse
- Re: [Pharo-users] Simple Spec Exam... btc
- Re: [Pharo-users] Simple Spec Exam... Sean P. DeNigris
- Re: [Pharo-users] Simple Spec ... Benjamin
- Re: [Pharo-users] Simple Spec ... Sean P. DeNigris
- Re: [Pharo-users] Simple Spec ... Camillo Bruni
- Re: [Pharo-users] Simple Spec Examples btc
- Re: [Pharo-users] Spec Lists - setting the selection Benjamin
- Re: [Pharo-users] Spec Lists - setting the selectio... Stéphane Ducasse
- Re: [Pharo-users] Spec Lists - setting the selectio... btc