Hello,
It's been a while since I tried out Pharo. I always struggled with Morphic UI's, but I noticed Spec and there seemed to be enough examples floating around that I thought I'd give it another try. Is Spec "here to stay?" Is it worthwhile to figure it out? It seems like with the developing possibilities of OSWindow-SDL2, one might use Spec to compose native widgets as well. My main question is about synchronizing domain changes with a Spec UI. For example, if I create an empty list of items: aList := OrderedCollection new. And create and open a ListModel that uses that list: aListModel := ListModel new items: aList;openWithSpec;yourself. I get a nice empty list. If I add an item to my list: aList add: 1. Then I need to update the list with another:
To see it show up. Alternatively (this seems wrong), I can add an item to the ListModel listItems directly: aListModel items: (aListModel listItems add: 1; yourself). Thank you, Rob |
Hi Bob,
to answer your 2 questions briefly: Yes, Spec is here to stay for good, and the idea is that it can compose any kind of widgets, so with a bridge to OSWindow-SDL2 that should work as well. When changing items in the list, you need to inform the widget of that. To do that you need to call the updateList method on your ListModel instance. So in your example: aList add: 1. aListModel updateList. HTH,
---> Save our in-boxes! http://emailcharter.org <---
Johan Fabry - http://pleiad.cl/~jfabry PLEIAD and RyCh labs - Computer Science Department (DCC) - University of Chile |
In reply to this post by Rob Rothwell
In Pharo5, you can download Ancestry from the Catalog browser,
that provides an example of this. https://vimeo.com/158063568 Stephan |
Thanks Stephan, this is a very nice example of lots of Spec usage that I'm sure I can learn a lot from!
As far as refreshing the list view, you did the same thing that I found to work by using the ListModel>>items: message, which in your case was very natural because you are creating a new, filtered list after a new person has been added. Thanks again for pointing this out to me, Rob
|
In reply to this post by jfabry
Thanks Johan, for your reply.
That's great that there is a path forward with Spec; I think I'll be able to figure it out!
I'll have to dig deeper into updateList, because right now the only thing it seems to do for me is clear any list selections, so I'm not sure if there is supposed to be a relationship between the original collection passed to the ListModel with the items: message or not. Thanks again, Rob
|
Free forum by Nabble | Edit this page |